CreateEmptyObject

Purpose:

Create an empty object to store properties and values: [objectName('propertyName')]

Category:

JSON

Syntax:

CreateEmptyObject [object var]

object var

Variable to store the object properties and values.

Example:

CreateEmptyObject [MyObjectVar]
SetVar [MyObjectVar('name')] "John"

SetVar [MyObjectVar('age')] 43


LoadJSON

Purpose:

Load a JSON file from a URL synchronously into a variable

Category:

JSON

Syntax:

LoadJSON "file URL" [result object var]
file URL

URL to retrieve the JSON data from.

result object var

Variable to store the object properties and values from the JSON data.

Example:

LoadJSON "https://jsonplaceholder.typicode.com/todos/4" [myvar]

SetVar [regtitle] [myvar('title')]

SetVar [regid] [myvar('id')]

AlertBox "JSON values:" "Title: [regtitle], Id: [regid]" ""


LoadAsyncJSON

Purpose:

Load a JSON file from a URL asynchronously and sends the data to a subroutine once loaded

Category:

JSON

Syntax:

LoadJSON "file URL" "subroutine"
file URL

URL to retrieve the JSON data from.

subroutine

Subroutine to execute once the data has been loaded.
The subroutine will recieve the data as a parameter.

Example:

LoadAsyncJSON "https://jsonplaceholder.typicode.com/todos/4" "mysubroutine"


ParseJSON

Purpose:

Parse a string (written in JSON format) and return an object with properties and values: [objectName(property)]

Category:

JSON

Syntax:

ParseJSON "JSON string" [result object var]

JSON string

Data string in JSON format.

result object var

Variable to store the object properties and values from the JSON data.

Example:

ParseJSON "{ 'name':'John', 'age':30, 'city':'New York'}" [myvar]


StringifyJSON

Purpose:

Stringify an object with properties and values: [objectName(property)] to a string written in JSON format

Category:

JSON

Syntax:

StringifyJSON [source object var] [result var]
source object var

Object variable to stringify with data in JSON format.

result var

Variable to store the result string.

Example:

StringifyJSON [myobjectvar] [myvar]


CsvToJSON

Purpose:

Parse CSV data into JSON format.
First CSV line should store the field names.

Category:

JSON

Syntax:

CsvToJSON [csv data] "delimiter character" [json object]

[csv data]

A variable with the CSV data.

delimiter character

 Character that delimits data in CSV (usually "," or ";")

[json object]

 Object variable to store the result

Example:

CsvToJSON [mycsv] ";" [myjson]