JSON

Extracts data from a JSON file.

The following parameters are available.

Parameters

Description

Source

JSON file

  • URL: HTTP address of the source file

    If another operator supplies the URL dynamically, the URL cannot be edited here.

    Example

    http://myhost.company:1080/documents/rest/links/03388871-367d-4abe-a2c9-37bc9fa44580?tenantid=default&revision=1

  • URL alias: Alias of a URL configuration. Only URL aliases for that you have the Usage privilege are available. Select a URL alias. For details, see Manage URL aliases.
  • File alias: Loads file from a resource directory. Files must be located in a defined resource directory on the MashZone NextGen server.

    Path prefix (alias): Alias of the resource directory with the path to a directory on the server. Select an alias of the local resource directory.

    In the input box, enter a path to the relevant data source file for the Path prefix (alias) selected.

    Example

    /documents/rest/links/03388871-367d-4abe-a2c9-37bc9fa44580?tenantid=default&revision=1

The file size is limited to 80 MB.

Browse file alias (...)

Enables you to browse the resource directories with the alias defined. Click the Browse file alias (...) button and select the required source file. At least one resource directory must exist. For details, see Manage resource directories.

Insert parameter (Insert parameter)

Inserts user defined input parameters at the cursor position. The button is only clickable if at least one user input parameter, for example, Text user input, has been inserted in the feed definition.

For details, see URL parameter syntax.

Parameter options (Parameter options)

Enables you to set input parameter options

Refresh rate ()

Specifies the time span before the source file is read in again. Default valueThe default value is 30 sec.

Authentication

Specifies a HTTP basic access authentication or an existing authentication defined in the administration.

User name and password are required for accessing the source file.

HTTP headers

Adds HTTP headers to the URL

Repeating object: Detect

Reads out the repeating object automatically. A repeating object already set by a user will not be considered. The detected columns are displayed in the Columns box depending on the repeating object.

JSON object that is repeated for each row;

You can edit the repeating object manually.

Specify a valid XQuery 3.1 lookup expression, for example,

?catalog?journal?articles?*

?data?rows?*

?catalog?books?*

A JSON document is loaded as a nested structure of maps and arrays. The above expressions use the (terse form of the) map/array lookup syntax as follows:

- The initial '?' is a unary lookup operator that selects a named member of the root map

- Further '?' are postfix lookup operators

- '?*' selects all members of an array, for example, '?5' selects the fifth element of an array.

For more information about the lookup syntax, see https://www.w3.org/TR/xquery-31/#id-lookup.

Advanced parsing options

Charset: Character set in which the source file is coded. This can be set manually if the extracted data refers to a different coding type.

By default, the HTTP response encoding is used if available, otherwise UTF-8 is used.

Columns: Detect

Reads out the columns of the data source automatically. The requested columns lists are displayed, based on the specified repeating object.

Configure columns

Configures the columns list. Deselect a column to exclude it from the result data. If you enter a New name for a column, it is used instead of the original column name in the result. If you click Reset columns, the column list is reloaded from the data source and all changes in the list are undone.

For detailed information on configuring the time zone used by this operator, see the chapter Configure feed processing time zone.

Upload JSON files to the MashZone NextGen Repository. If required, you can upload CSV files to the MashZone NextGen Repository. For details, see Add External Resources as MashZone NextGen Files.

To upload a file to the MashZone NextGen Repository administration privileges are required.

If you use an absolute URL, for example, http://myhost.company:1080/documents/rest/links/03388871-367d-4abe-a2c9-37bc9fa44580, an authentication has to be set. All requests to the uploaded file are made with the specified user/password combination.

If you use a relative URL, for example, /documents/rest/links/03388871-367d-4abe-a2c9-37bc9fa44580, an authentication is not required. All requests to the uploaded file are made with the current logged in user.

In some cases, it might be necessary to grant view permission for a user. This can be done with the API console, e.g.:

{

"version":"1.1",

"sid":"PolicyService",

"svcVersion":"0.1",

"oid":"addPermissions",

"params":[

"fileName","type.entity.file","VIEW",

[{"principalId":"userID","principalTypeId":"User"}]]

}