MoneyWorks Manual
Edit
!--sphider_noindex-->
JSON_Parse (jsonText)
Result type: JSON object handle
Definition: Parses the JSON and returns a JSON object handle that can be used to query the resulting object.
Example:
// get original description from JSON transaction (see below)
let jsonObjectHandle = JSON_Parse(jsontext)
// access description from item 0 in the transaction array
let subObject = JSON_Get(jsonObjectHandle, "transaction", 0, "description")
let s = JSON_Get(subObject, "original")
JSON_Free(subObject)
JSON_Free(jsonObjectHandle)
Returns "0150 Amazon Santa Ana CA 55.73USD" when jsontext is:
{
"transaction": [
{
"CONTAINER": "bank",
"id": 2829798,
"amount": {
"amount": 12345.12,
"currency": "USD"
},
"description":{
"original": "0150 Amazon Santa Ana CA 55.73USD",
"consumer": "Electronic Purchases",
"simple": "Amazon Purchase"
}
}
]
}
Free the JSON object handle with JSON_Free() when you are finished with it.
See Also:
JSON_AsArray: Convert JSON to an associative array
JSON_AsXML: Convert JSON to XML
JSON_Free: Free a parsed JSON structure or reference to a subobject thereof
JSON_GetArray: Return a JSON object as an associative array
ParamsFromArray: Expand array values to a variable parameter list