MoneyWorks Manual
Edit
!--sphider_noindex-->
JSON_GetArray (JSON_object, id [, id, ... ])
Result type: array
Definition: Works like JSON_Get, except if the identified node is an object or an array rather than a simple value, the result will be an associative array containing the structured object data. You can pass just the top-level JSON handle from JSON_Parse to get the entire structure
on LoadFromScriptEditor let jsontext = <<JSON { "shipmentId": "SH12345", "origin": { "address": "123 Warehouse Lane", "city": "New York", "state": "NY", "zip": "10001", "country": "USA" }, "destination": { "address": "456 Delivery Blvd", "city": "Los Angeles", "state": "CA", "zip": "90001", "country": "USA" } } JSON let jsonhandle = JSON_Parse(jsontext) let a = JSON_GetArray(jsonhandle, "destination") foreach k in array a syslog(k + " = " + a[k]) endfor JSON_Free(jsonhandle) end
output:
address = 456 Delivery Blvd city = Los Angeles country = USA state = CA zip = 90001
Availability: available within MWScript handlers in MoneyWors v9.2.3 and later.
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