Arrays - 7.3

Talend Data Mapper User Guide

Version
7.3
Language
English
Product
Talend Big Data Platform
Talend Data Fabric
Talend Data Management Platform
Talend Data Services Platform
Talend MDM Platform
Talend Real-Time Big Data Platform
Module
Talend Studio
Content
Design and Development > Designing Jobs
Last publication date
2023-01-05
An array in JSON appears as a loop in the structure. All of the other elements are defined as you would expect, in a hierarchy based on the JSON objects. Arrays in JSON have the following situations, depending on the possible members:
  • All same typed non-objects - Every member of the array is a non-object (decimal, double, string or boolean) and they are all the same type (not decimals mixed with doubles for example). In this case, the element of the array will loop, have the data type corresponding to the detected non-object type, and will not be a container.

  • All objects - Every member of the array is an object. This is handled like any other object nesting.

  • Mixture of objects and non-objects - The "mixed" case where some members of the array are objects and others are non-objects. Alternatively all members could be non-objects, but their types are not the same (a mix of decimal numbers and strings for example).

    This is not treated as a loop, but rather a specific collection of the objects and non-objects as specified in the array and a separate element is created for each. The usual member element is created for each object. For the non-objects, an anonymous member with the name _anonDecimal (replacing Decimal with String, Double, or Boolean) is created for each type of non-object that is present. Each element name in this "mixed" array will be suffixed with the position of the element in the array.

    Note: For the JSON SAX Reader and Writer to be able to read a mixed JSON array, use the choice type.