Syntax
JSONGetKeys <json-var>Description
Return a list of the member names contained in a JSON object.Parameters
<json-var>
- The JSON object whose member names are desired.
Remarks
JSON (JavaScript Object Notation) is a lightweight data format based on the object notation of the JavaScript language. It does not require JavaScript to read or write; it is easy to parse by any language and libraries and tools exist in many languages to handle JSON.Here is the entire list of PhantomScript JSON statements: ListAsJSONArray, JSONAddArray, JSONAddBoolean, JSONAddNull, JSONAddNumber, JSONAddObject, JSONAddString, JSONArrayAsList, JSONGetKeys, JSONGetType, JSONGetValue, JSONDelete.
Example
Local jsonObj1
JSONAddString jsonObj1 "string1" "a string value"
JSONAddNumber jsonObj1 "a-number" 42
JSONAddBoolean jsonObj1 "a-boolean" (1 = 1)
Log "keys = " & JSONGetKeys jsonObj1
jsonObj = JSONDelete jsonObj1 "a-number"
Log "keys = " & JSONGetKeys jsonObj1The above script fragment logs the following:
keys = string1,a-number,a-boolean keys = string1,a-boolean