JSON String to ESP Formatter Module Configuration

The JSON String to ESP formatter translates JSON strings to AepRecord objects. Set values for this formatter in the adapter configuration file.

This formatter is row based and can connect two row based transporters rather than streaming based transporters.
XML Element Description
ColumnMappings

(Required) Element containing the ColsMapping element.

ColsMapping

Type: complexType

(Required) Element which contains the Column element. You can have multiple ColsMapping elements if you are using an ESPMultiStreamPublisher.

This element has two attributes:
  • streamname – the ESP stream to which you want to publish JSON data.
  • rootpath – a root path for the JSON data. This must be an array. See the Column element for an example of a root path value.
Column

Type: string

(Required) Specify a JSONPath expression for the JSON data that you want to map to columns of an ESP stream. This expression is matched to the value specified in the rootpath attribute of the ColsMapping element, if applicable. You can have multiple Column elements.

There are two types of JSON data: array or object. For example, if you had the following JSON data about a person,
{
"firstName": "John",       
"lastName": "Smith", 
"phoneNumbers": [
        {
            "type": "home",
            "number": "212 555-1234"
        },
        {
            "type": "fax",
            "number": "646 555-4567"
        }
],
"friends": [
["female1","female2","female3"],
["male1","male2","male3"]
]
}
you could get the individual's first name by using the JSONPath expression firstname. If you want the first phone number, specify phoneNumbers[0].number as the JSONPath expression. You would not have to specify a rootpath value.

If you want the numbers and types of phone numbers, specify phoneNumbers as the rootpath value and numbers and type as the JSONPath expressions in the Column element.

You can also specify * for Column which indicates you want all the data in an array (that does not have key value data within it). For example, if you wanted all the female friends data, specify friends[1] for rootpath and * for Column.

The first <Column/> element and its value are mapped to the first column of an ESP stream, the second <Column/> element and its value are mapped to the second column of an ESP stream, and so on.

DateFormat

Type: string

(Advanced) The format string for parsing date values. For example, yyyy-MM-dd'T'HH:mm:ss.

TimestampFormat

Type: string

(Advanced) Format string for parsing timestamp values. For example, yyyy-MM-dd'T'HH:mm:ss.SSS.