Transformations > Hierarchy Processor transformation > Running a mapping with JSON data
  

Running a mapping with JSON data

When you run an elastic mapping that contains a Hierarchy Processor transformation with JSON-formatted data, you must create a mapping task. You cannot test the mapping using the Run button in the Mapping Designer.
Hierarchical input files
When an input file is in JSON format, the schema often spans across multiple lines. For example:
{
"Name": "Tom",
"Surname": "Day",
"City": "Redwood City",
"State": "CA",
"Country": "USA",
"Zip": "94063"
}
The following example shows the same JSON-formatted schema in a single line:
{"Name":"Tom","Street":"2100 Seaport Blvd","City":"Redwood City","State":"CA","Country":"USA","Zip":"94063"}
To read JSON-formatted input that spans across multiple lines, set the following advanced session property in the mapping task:
Session Property Name
Session Property Value
advanced.custom.property
infaspark.json.parser.multiLine=True
Note: If this property is not set, a multiple-line JSON input file will result in an output file with null values in every column.
Hierarchical output files
When the output is a JSON-formatted file, the Spark engine writes each output record to a separate file by default.
To write the output records to one JSON-formatted file, set the following Spark session property in the mapping task:
Session Property Name
Session Property Value
spark.sql.shuffle.partitions
1