loadJSON(file, [userAgent])

Reads the contents of a JSON file and returns an object with the data. If the file is specified by name as string, the path can point either directly at a file in the document’s data directory or be specified as an absolute path.

Type: function

Parameter(s):

  • file {String | File}:

    The JSON file name in the document’s data directory, an absolute path to a JSON file, a File instance or an URL.

  • userAgent {String} Optional:

    Optional parameter when URL is used, to specify a user-agent making request.

Returns:

  • {Object}:

    The resulting data object.