Configuring JSON Connectors

JavaScript Object Notation (JSON), like XML is a hierarchically structured textual data format. A JSON object might look something like this:

{ "records": [ { "record": { "attribute1": "value1", "attribute2": null, "numericAttribute": 1.0 } }, { "record": { "attribute1": "value2", "attribute2": "abc", "numericAttribute": null } } ] }

JSON represents data as nested {"attribute" : value} pairs which constitute an object. In this example, the object has one attribute called "records" whose value is a list delimited by brackets []. In the list are two objects, each having a single attribute "record" whose value is an object delimited by braces {} and having three attributes of its own.

Querying JSON

JSON can be queried using a language called JSON Path. JSON Path is described here: http://goessner.net/articles/JsonPath/. Basic JSON Path expressions are a series of attribute names delimited by ".". Brackets are used to indicate an index in an list and start with zero. For example records[0].record.attribute1 would resolve to "value1" in the example above. JSON Path also allows for wild cards. In JSON Path this is the * character, but for connectos please use #. For example records[#].record would resolve to:

[ { "attribute1": "value1", "attribute2": null, "numericAttribute": 1.0 }, { "attribute1": "value2", "attribute2": "abc", "numericAttribute": null } ]

Defining a JSON Connector

When defining a JSON connector five fields are important in the connector and connector field configurations:

In all cases

Parameter Description Example

CharacterEncoding

the text encoding to use when writing or reading JSON

“UTF-8”

For Imports

For Exports

Note: When exporting, JSON writes null values as {"attribute" : null}. Use a connector rule to modify the field if a different value is desired.