Show TOC

File/Hadoop JSON Input Adapter Studio PropertiesLocate this document in the navigation structure

Adapter type: toolkit_file_json_input. The File/Hadoop JSON Input adapter writes JSON-formatted data to a file or a Hadoop Distributed File System (HDFS). Configure its properties using the SAP Event Stream Processor Studio. The File/Hadoop JSON Input adapter uses SimpleDateFormat formatting codes.

If you use the CCL ATTACH ADAPTER statement to attach an adapter, you must supply the adapter type.

Property Label Description
JSON Column Mapping List

Property ID: jsonColsMappingList

Type: string

(Required) Specify JSONPath expressions which represent JSON data to map to ESP streams. Separate these values using commas. 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 root path (see the jsonRootpath property below).

If you want the numbers and types of phone numbers, specify phoneNumbers as the jsonRootpath value and numbers and type as the JSONPath expressions in the jsonColsMappingList property.

You can also specify * for jsonColsMappingList 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 jsonRootpath and * for jsonColsMappingList.

The first JSONPath expression is mapped to the first column of a stream, the second expression is mapped to the second column of a stream, and so on.

JSON Root Path

Property ID: jsonRootpath

Type: string

(Optional) Specify a root path for the JSON data. This must be an array. See examples in the jsonColsMappingList property description above.

SecondDate Format

Property ID: jsonSecondDateFormat

Type: string

(Advanced) Specify the format for parsing SecondDate values.

For example, yyyy-MM-dd'T'HH:mm:ss is the default value.

MsDate Format

Property ID: jsonMsDateFormat

Type: string

(Advanced) Specify the format for parsing MsDate values.

For example, yyyy-MM-dd'T'HH:mm:ss.SSS is the default value.

Time Format

Property ID: jsonTimeFormat

Type: string

(Advanced) Specify the format for parsing time values.

For example, HH:mm:ss is the default value.

BigDatetime Format

Property ID: jsonBigDatetimeFormat

Type: string

(Advanced) Specify the format for parsing bigdatetime values.

The default value is yyyy-MM-dd'T'HH:mm:ss.SSSSSS. Using less than six Ss gives precision to that exact number of Ss and ignores values past that specification. Using more than six Ss truncates any values beyond the sixth, and replaces them with zero. This may result in slower behavior.

Directory

Property ID: dir

Type: directory

(Required) Specify the absolute path to the data file which you want the adapter to read. For example, <username>/<foldername>.

(Required) Specify the absolute path to the data file which you want the adapter to read. For example, <username>/<foldername>.

To use Hadoop system files, use an HDFS folder uri instead of a local file system folder. For example, hdfs://<hdfsserver>:9000/<foldername>/<subfoldername>/<leaffoldername>.

To use Hadoop, download the binaries for Hadoop version 1.2.1 or 2.2.0 from http://hadoop.apache.orgInformation published on non-SAP site. For version 1.2.1, copy the hadoop-core-1.2.1.jar file to %STREAMING_HOME%\adapters\framework\libj.

For version 2.2.0, copy these files over to %STREAMING_HOME%\adapters\framework\libj:
  • hadoop-common-2.2.0.jar
  • hadoop-auth-2.2.0.jar
  • hadoop-hdfs-2.2.0.jar
  • guava-11.0.2.jar
  • protobuf-java-2.5.0.jar
Ensure you use a stable version rather than a beta.

Use a forward slash for both UNIX and Windows paths.

File (in Directory)

Property ID: file

Type: string

(Required) Specify the file to read. Wildcards are allowed.

Dynamic Loading Mode

Property ID: dynamicMode

Type: string

(Optional) Set dynamic mode for reading files. Valid values: static, dynamicFile, dynamicPath.

Poll Period (seconds)

Property ID: pollingPeriod

Type: int

(Advanced) Specify the poll period when dynamicMode is dynamicFile or dynamicPath.

Remove Files After Processing

Property ID: removeAfterProcess

Type: boolean

(Optional) Removes files after they have been processed.

PropertySet

Property ID: propertyset

Type: string

(Advanced) Specifies the name of the property set. Property sets are reusable sets of properties that are stored in the project configuration file. Using these sets allows you to move adapter configuration properties out of the CCL file and into the CCR file. If you specify the same properties in the project configuration file and the ATTACH ADAPTER statement, the values in the property set override the values defined in the ATTACH ADAPTER statement. No default value.