Option Public
Option Declare
Use "ls.snapps.JSONReader"
Sub Initialize
Dim INPUTJSONSTRING1 As String 'Will contain mono-line string<br/>
Dim INPUTJSONSTRING2 As String 'Will contain multi-line string<br/>
Dim jsonReader As JSONReader<br/>
Dim vResults As Variant<br/>
Dim vPieces As Variant<br/>
<br/>
INPUTJSONSTRING1 = INPUTJSONSTRING1 & |{ "people" : [{"Name" : "CN=John Bigboote/O=Yoyodyne" , "MultiValueDates" : [1/4/2009 , 1/11/2009 , 1/18/2009 , 1/25/2009 , 2/1/2009|<br/>
INPUTJSONSTRING1 = INPUTJSONSTRING1 & | , 2/8/2009 , 2/15/2009 , 2/22/2009 , 3/1/2009 , 3/8/2009 , 3/15/2009 , 3/22/2009 , 3/29/2009 , 4/5/2009 , 4/12/2009 , 4/19/2009 , 4/26/2009] , |<br/>
INPUTJSONSTRING1 = INPUTJSONSTRING1 & |"MultiValueDoubles" : [3.50 , 3.50 , 3.50 , 3.50 , 2.00 , 0.00 , 0.00 , 0.00 , 0.00 , 0.00 , 0.00 , 0.00 , 0.00 , 0.00 , 0.00 , 0.00 , 0.00]} ,{"Name" |<br/>
INPUTJSONSTRING1 = INPUTJSONSTRING1 & |: "CN=John Smallberries/O=Yoyodyne" , "MultiValueDates" : [1/4/2009 , 1/11/2009 , 1/18/2009 , 1/25/2009 , 2/1/2009 , 2/8/2009 , 2/15/2009 , 2/22/2009 |<br/>
INPUTJSONSTRING1 = INPUTJSONSTRING1 & |, 3/1/2009 , 3/8/2009 , 3/15/2009 , 3/22/2009 , 3/29/2009 , 4/5/2009 , 4/12/2009 , 4/19/2009 , 4/26/2009] , "MultiValueDoubles" : [2.31 , 2.31 , 2.31 |<br/>
INPUTJSONSTRING1 = INPUTJSONSTRING1 & |, 2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31]} ,{"Name" : "CN=John Yaya/O=Yoyodyne" , |<br/>
INPUTJSONSTRING1 = INPUTJSONSTRING1 & |"MultiValueDates" : [1/4/2009 , 1/11/2009 , 1/18/2009 , 1/25/2009 , 2/1/2009 , 2/8/2009 , 2/15/2009 , 2/22/2009 , 3/1/2009 , 3/8/2009 , 3/15/2009 , |<br/>
INPUTJSONSTRING1 = INPUTJSONSTRING1 & |3/22/2009 , 3/29/2009 , 4/5/2009 , 4/12/2009 , 4/19/2009] , "MultiValueDoubles" : [2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31 |<br/>
INPUTJSONSTRING1 = INPUTJSONSTRING1 & |, 2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31]} ,{"Name" : "CN=John Manyjars/O=Yoyodyne" , "MultiValueDates" : [1/4/2009 , 1/11/2009 , 1/18/2009 , |<br/>
INPUTJSONSTRING1 = INPUTJSONSTRING1 & |1/25/2009 , 2/1/2009 , 2/8/2009 , 2/15/2009 , 2/22/2009 , 3/1/2009 , 3/8/2009 , 3/15/2009 , 3/22/2009 , 3/29/2009 , 4/5/2009 , 4/12/2009 , 4/19/2009 , |<br/>
INPUTJSONSTRING1 = INPUTJSONSTRING1 & |4/26/2009] , "MultiValueDoubles" : [2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31 , |<br/>
INPUTJSONSTRING1 = INPUTJSONSTRING1 & |-36.96]} ,{"Name" : "CN=John Whorfin/O=Yoyodyne" , "MultiValueDates" : [1/4/2009 , 1/11/2009 , 1/18/2009 , 1/25/2009 , 2/1/2009 , 2/8/2009 , 2/15/2009 |<br/>
INPUTJSONSTRING1 = INPUTJSONSTRING1 & |, 2/22/2009 , 3/1/2009 , 3/8/2009 , 3/15/2009 , 3/22/2009 , 3/29/2009 , 4/5/2009 , 4/12/2009 , 4/19/2009 , 4/26/2009] , "MultiValueDoubles" : [2.31 , |<br/>
INPUTJSONSTRING1 = INPUTJSONSTRING1 & |2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31]} ,{"Name" : "CN=John Parker/O=Yoyodyne" |<br/>
INPUTJSONSTRING1 = INPUTJSONSTRING1 & |, "MultiValueDates" : [4/26/2009] , "MultiValueDoubles" : [0.00]}]}|<br/>
<br/>
'The string below is structurally identical to the string above (from a JSON perspective), except it contains carriage returns that allow for easier reading and editing<br/>
<br/>
INPUTJSONSTRING2 = |{ "people" : [<br/>
{
"Name" : "CN=John Bigboote/O=Yoyodyne" ,
"MultiValueDates" : [1/4/2009 , 1/11/2009 , 1/18/2009 , 1/25/2009 , 2/1/2009 , 2/8/2009 , 2/15/2009 , 2/22/2009 , 3/1/2009 , 3/8/2009 , 3/15/2009 , 3/22/2009 , 3/29/2009 , 4/5/2009 , 4/12/2009 , 4/19/2009 , 4/26/2009] ,
"MultiValueDoubles" : [3.50 , 3.50 , 3.50 , 3.50 , 2.00 , 0.00 , 0.00 , 0.00 , 0.00 , 0.00 , 0.00 , 0.00 , 0.00 , 0.00 , 0.00 , 0.00 , 0.00]
} ,
{
"Name" : "CN=John Smallberries/O=Yoyodyne" ,
"MultiValueDates" : [1/4/2009 , 1/11/2009 , 1/18/2009 , 1/25/2009 , 2/1/2009 , 2/8/2009 , 2/15/2009 , 2/22/2009 , 3/1/2009 , 3/8/2009 , 3/15/2009 , 3/22/2009 , 3/29/2009 , 4/5/2009 , 4/12/2009 , 4/19/2009 , 4/26/2009] ,
"MultiValueDoubles" : [2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31]
} ,
{
"Name" : "CN=John Yaya/O=Yoyodyne" ,
"MultiValueDates" : [1/4/2009 , 1/11/2009 , 1/18/2009 , 1/25/2009 , 2/1/2009 , 2/8/2009 , 2/15/2009 , 2/22/2009 , 3/1/2009 , 3/8/2009 , 3/15/2009 , 3/22/2009 , 3/29/2009 , 4/5/2009 , 4/12/2009 , 4/19/2009] ,
"MultiValueDoubles" : [2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31]
} ,
{
"Name" : "CN=John Manyjars/O=Yoyodyne" ,
"MultiValueDates" : [1/4/2009 , 1/11/2009 , 1/18/2009 , 1/25/2009 , 2/1/2009 , 2/8/2009 , 2/15/2009 , 2/22/2009 , 3/1/2009 , 3/8/2009 , 3/15/2009 , 3/22/2009 , 3/29/2009 , 4/5/2009 , 4/12/2009 , 4/19/2009 , 4/26/2009] ,
"MultiValueDoubles" : [2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31 , -36.96]
} ,
{
"Name" : "CN=John Whorfin/O=Yoyodyne" ,
"MultiValueDates" : [1/4/2009 , 1/11/2009 , 1/18/2009 , 1/25/2009 , 2/1/2009 , 2/8/2009 , 2/15/2009 , 2/22/2009 , 3/1/2009 , 3/8/2009 , 3/15/2009 , 3/22/2009 , 3/29/2009 , 4/5/2009 , 4/12/2009 , 4/19/2009 , 4/26/2009] ,
"MultiValueDoubles" : [2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31 , 2.31]
} ,
{
"Name" : "CN=John Parker/O=Yoyodyne" ,
"MultiValueDates" : [4/26/2009] ,
"MultiValueDoubles" : [0.00]
}
]}|
<br/>
Set jsonReader = New JSONReader<br/>
Set vResults = jsonReader.Parse(INPUTJSONSTRING1) 'this is a JSONObject (so don't forget to put the Set)<br/>
vPieces = vResults.Items<br/>
<br/>
Stop<br/>
Msgbox Typename(vPieces)<br/>
<br/>
Set vResults = jsonReader.Parse(INPUTJSONSTRING2) 'this is a JSONObject (so don't forget to put the Set)<br/>
vPieces = vResults.Items<br/>
<br/>
Stop<br/>
Msgbox Typename(vPieces)<br/>
End Sub