Hi,
I would like to be able to determine if a JSON string will be parseable as a LIST or as a MAP before processing it.
Am I missing something, or is the only way to know is to test the first character?
"[" = LIST
"{" = MAP
Any other idea?
Thanks
I would like to be able to determine if a JSON string will be parseable as a LIST or as a MAP before processing it.
Am I missing something, or is the only way to know is to test the first character?
"[" = LIST
"{" = MAP
code:
Dim json As JSONParser
json.Initialize(StdOut)
If json.IsInitialized Then
If StdOut.StartsWith("[") Then
For Each Program As Map In json.NextArray
'processing as a list of map
Next
Else
Dim Program As Map = json.NextObject
'processing as a map
End If
End If
Any other idea?
Thanks