Was this helpful?
JSON
JavaScript Object Notation (JSON) is a text-based open standard designed for human readable data interchange. It is derived from the JavaScript scripting language for representing simple data structures and associative arrays, called objects. Despite its relationship with JavaScript, it is language-independent with parsers available for many languages. The official Internet media type for JSON is application/json. The JSON filename extension is .json. The JSON format is often used for serializing and transmitting structured data over a network connection. It is used primarily to transmit data between a server and web application, serving as an alternative to XML. "JSON." Wikipedia, The Free Encyclopedia, http://en.wikipedia.org/wiki/JSON (accessed May 11, 2017).
Note:  Normally, schemas for target multimode connectors are not provided. However, for JSON connector, if the target file exists, then the UI connects using a source JSON Connection and then the schema is copied to the target.
JSON is built on two structures:
A collection of name/value pairs. In various languages, this is realized as an object, record, struct, dictionary, hash table, keyed list, or associative array.
An ordered list of values. In most languages, this is realized as an array, vector, list, or sequence.
Connectivity Requirements
The JSON connector allows you to store and connect to your source and target data using the following methods:
Source and target files can be stored on the local file system where DataConnect is installed, and then accessed through shared storage locations.
Source and target files can be stored in an external system and accessed through HTTP(S) requests.
Source and target connectors may be defined as a DJMessage type (djmessage:///<message name>)
Property Options
 
Property
S/T
Description
Batch Size
S
Number of source records the connector caches before processing them in a map. Default is 100.
Read Nulls
S
A Null value is defined by the value of a name:value pair being explicitly set to Null.
If this option is set to True, the connector reads null values in the source file.
If this option is set to False, null values in the source file are skipped. The null field is added to the schema, but it is skipped when the map is run.
Default is True.
Read Empty Tokens
S
If set to True, the connector reads empty array ([]) and empty object ({}) values in the source file.
If set to False, empty array ([]) and empty object ({}) values in the source file are skipped. The schema is updated with a reference to a new record and the JSON INPUT field holds the {} and [] characters, respectively. The characters in the JSON INPUT field are not mapped to the target.
Default is True.
Flush Frequency
T
Optional. The number of records buffered in memory before being written to the target file. Default is 0 (all records are written at once). If you are inserting many records, then changing the default to a higher value may improve performance. Default is 0.
Batch Response
T
Optional. The file to which CRUD operation results are written. The format is one entry per record, indicating success or failure. If operation fails, information about cause of failure is returned.
HTTP Write Method
T
To write to an HTTP target, select POST or PUT. Default is POST.
Supported Output Modes
JSON Connector supports the Replace output mode. For information about output modes, see Target Output Modes.
Data Types
JSON Connector supports the following data types that correspond to the fields in the target data table:
Boolean
Byte
Char
Date
Datetime
Decimal
Double
Float
Int
Long
Short
String
Time
Additional Information
Batch Response
A batch response file contains a group of entries for each connector used in a batch operation. Each action in the operation generates a batch response entry. These entries often provide detailed information, such as errors, that can be used for troubleshooting.
Example
<BatchResponse:batchResult xmlns:BatchResponse="http://www.actian.com/BatchResponse">
<BatchResponse:results>
</BatchResponse:results>
<BatchResponse:componentInfo>
<BatchResponse:returnCode>0</BatchResponse:returnCode>
<BatchResponse:componentName>JSON-DMS</BatchResponse:componentName>
</BatchResponse:componentInfo>
</BatchResponse:batchResult>
Schema Considerations
Normally, schemas for target multimode connectors are not provided. However, for JSON connector:
If the target file exists, the UI connects using a source JSON connection and then the schema is copied to the target. The schema is built from the data, which may be a subset of the actual schema.
If the target file does not exist, then a basic schema is created based on the source. The schema can be edited in advanced mode or an external schema can be configured.
Custom JSON
If the JSON_INPUT field is mapped on the target side, the field is a string field and the connector will treat the mapped string as Custom JSON. There are some considerations you need to take into account when using the JSON_INPUT field:
The JSON connector will not validate the data in the JSON_INPUT field. You are responsible for providing syntactically correct JSON.
WARNING!  The JSON connector may output invalid JSON if you do not validate the JSON when mapping the Custom JSON field.
If the JSON_INPUT field is mapped on a record, all child records of this record will be skipped, even if they are mapped. The remaining fields on the record will be skipped as well (even if they are mapped).
Since the JSON_INPUT field is a string, you must escape any string contained in the custom JSON data field. The following sample shows proper string syntax when mapping to the JSON_INPUT field:
User input to JSON_INPUT field:"{""Field"":""Value"", ""Field2"":12}""Connector output for JSON_INPUT:{"Field":"Value", "Field2":12}
In this example, Field, Value, and Field2 are strings. The value of 12 is an number.
Last modified date: 08/02/2023