Result = ParseJSON(#JSON, Input$ [, Flags])
Parse JSON data from a string. The JSONValue() function can be used to access the contained JSON value(s) after parsing.


#JSON A number to identify the new JSON. #PB_Any can be used to auto-generate this number.
Input$ The string containing the JSON data to parse.
Flags (optional) If set to #PB_JSON_NoCase, the JSON data will be parsed case insensitive. The default is to be case sensitive.

Return value

Nonzero if the JSON data was parsed correctly, zero otherwise. If #PB_Any was used for the #JSON parameter then the generated number is returned on success.


In case of an error, the JSONErrorMessage(), JSONErrorLine() and JSONErrorPosition() functions can be used to get more information about the error.

To parse JSON data directly from a memory buffer, the CatchJSON() function can be used instead.

JSON is a case sensitive data format. However, in some situations, such as deserializing structures with ExtractJSONStructure() or similar commands it may be useful to treat JSON objects as case insensitive. The #PB_JSON_NoCase flag causes all member related functions to treat keys in this object as case insensitive.


  If ParseJSON(0, "[1, 2, 3, 4, 5]")    
    For i = 0 To JSONArraySize(JSONValue(0)) - 1
      Debug GetJSONInteger(GetJSONElement(JSONValue(0), i))
    Next i

See Also

CreateJSON(), CatchJSON(), LoadJSON(), JSONValue(), FreeJSON(), JSONErrorMessage(), JSONErrorLine(), JSONErrorPosition(), ExportJSON()

Supported OS


<- NextJSONMember() - Json Index - RemoveJSONElement() ->