Edit

JSON_Get (JSON_object, id [, id, ... ])

Result type:  text, number, or JSON object handle depending on JSON object contents

Definition:  Extracts data or a sub-object from a JSON object obtained from JSON_Parse() or JSON_Get(). The extracted data is identified by the sequence of id identifiers, which will be textual id names, or, if the JSON structure being accessed is an array, a numeric index.

It is assumed that you know the structure of the JSON data in advance. If the element specified does not exist, the result will be NULL. When accessing an array by index, if the index is out of range, the return value will be NULL, thus you can iterate with an increasing index until you get a NULL result.

If JSON_Get returns an object or array reference (vs a string, number, or boolean value), you must free the reference when you are finished with it, using JSON_Free()s.

Example: 

on AddJSONTransactions(json)
    let t = 0
    let jObj = JSON_Parse(json)

    if not jObj    // the JSON is bad
        alert(GetLastErrorMessage())
        return NULL
    endif

    foreach i in (0, 9999)    // we don't know how big the array is; assume no more than this
        let jtrans = JSON_Get(jObj, "transaction", i)    // array index is 0-based
        if jtrans == NULL    // exit loop at end of array
            break
        endif
        let n = JSON_Get(jtrans, "amount", "amount")    // get amount element from amount subobject
        JSON_Free(jtrans)    // this is an object reference, so it must be freed
        let t = t + n
    endfor
    JSON_Free(jObj)
    return t
end

See Also:

JSON_AsXML: Convert JSON to XML

JSON_Free: Free a parsed JSON structure

ParamsFromArray: Expand array values to a variable parameter list