JSON.Parse: Difference between revisions
Jump to navigation
Jump to search
Line 32: | Line 32: | ||
[[Category:Language Reference]] | [[Category:Language Reference]] | ||
[[Category:Miscellaneous]] |
Revision as of 22:29, 13 September 2012
Json.Parse (string[, reviver])
Description
Json.Parse converts a string created by JSON.STRINGIFY into an object. It is useful for interchanging data with other systems and for saving objects to localStorage and databases. string is the string to be converted. reviver is an optional function name that can be used to do some processing of the data while being parsed.
Example
Rem Json.Parse Example myObject=Json.Parse(s, reviver) Print "myObject.a:" & myObject.a & " myObject.b:" & myObject.b Function reviver(key, value) If key="a" and TypeName(Value)= "Integer" Then reviver=CStr(value) 'If value is a number, we want to change it to string. Else reviver=value End If End Function
Output
myObject.a:12355 myObject.b:4