<< Click to Display Table of Contents >> Navigation: ThinBASIC Modules > cJSON > CCJson class > <CCJson> Properties > <CCJson>.IsValid |
Description
Indicates whether the previously parsed JSON parse operation was valid.
Same as <CCJson>.Valid but easier to read in source code
Syntax
n = <CCJson>.IsValid
Returns
Non-zero value for valid JSON.
Remarks
Restrictions
See also
Examples
uses "cjson", "console"
dim json as new CCJson ' Create an empty CCJson object
json.Parse("{'name': 'Eros'}") ' Parse invalid JSON string
printl "Is valid?: " + json.IsValid ' IsValid will return 0, because the JSON is invalid (because of usage of ' instead of ")
json.Parse("{""name"": ""Eros""}") ' Parse JSON string to be further processed by json object
printl "Is valid?: " + json.IsValid ' IsValid will return non-zero value, because the JSON is correct
waitkey