READJSON

Purpose:

 Returns a JSON object from a file or URL.

Syntax:

READJSON("url", "header")

"url"

-

A string, the source file or URL address.

"header"

-

Optional. A string, the HTML header. Defaults to "Content-Type: application/json"

Returns:

An object, the JSON object from the file or URL.

Example:

readjson(gethome() + "data\example.json")

 

Displays an object from a JSON file that contains information on a set of superheros.

Example:

readjson("https://ipinfo.io/json")

 

Displays an object that contains information on the current IP address.

Example:

readjson("https://vpic.nhtsa.dot.gov/api/vehicles/getallmanufacturers?format=json")

 

Displays an object where the Results property contains 100 automobile manufacturers.

Example:

dspobj = readjson("https://vpic.nhtsa.dot.gov/api/vehicles/getallmanufacturers?format=json")

 

Same as above except the returned JSON object is assigned to the variable dspobj.

Remarks:

READJSON returns a JSON object for the input file or URL.

 

The initial returned JSON string is converted to an object.

 

If no output is provided, the object is displayed in a pop-up dialog box.

See Also:

GETURL

GOTOURL

PUTURL

READTABLE

VIEWHTML