$GetJSON
Welcome to our Knowledge Base
Documentation | Blog | Demos | Support
< All Topics
Print
$GetJSON
5 out of 5 stars
1 rating
5 Stars | 100% | |
4 Stars | 0% | |
3 Stars | 0% | |
2 Stars | 0% | |
1 Stars | 0% |
Reads a text file containing a JSON structure and places its compressed contents in a variable.
Syntax
$getjson(<a variable>, <a document name>)
Parameters
a variable | a variable, a field name or a form field name receiving the contents of the document |
a document | a valid Zim:X document name pointing to a JSON structured text file |
Return Value
It always returns a single character with the value “0”.
Comments
The receiving variable name must be large enough to hold the entire compressed JSON text file. It will also contain the string “ZIMJSON” as an indication that the text was obtained from a text file and that it is compressed.
The function $GetJSON does not validate the JSON syntax present in the document. Therefore, the function can also be used to compress any kind of text file.
Example
Given the following JSON file pointed by a ZIM:X document called MyDocument:
{ "employee": { "name": "sonoo", "salary": 56000, "married": true } }
The command:
OUT $GetJSON(MyVar3000, MyDocument)
Will return:
ZIMJSON = {"employee":{"name":"sonoo","salary":56000,"married":true}}
See Also
Updated
ByJason Lee
Was this article helpful?
5 out of 5 stars
1 rating
5 Stars | 100% | |
4 Stars | 0% | |
3 Stars | 0% | |
2 Stars | 0% | |
1 Stars | 0% |
5