$GetJSON

$GetJSON

Welcome to our Knowledge Base

Documentation | Blog | Demos | Support

< All Topics
Print

$GetJSON

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 variablea variable, a field name or a form field name receiving the contents of the document
a documenta 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

$findjson

Was this article helpful?
0 out of 5 stars
5 Stars 0%
4 Stars 0%
3 Stars 0%
2 Stars 0%
1 Stars 0%
5
How can we improve this article?
Please submit the reason for your vote so that we can improve the article.

Leave a Reply

Your email address will not be published. Required fields are marked *

en_CAEnglish