lyassa087137

JSON Arrays – Repeating vs Absolute

Discussion created by lyassa087137 on Aug 29, 2018

When defining an array element in a JSON profile, you are presented with two options, “Array (Repeating)” and “Array (Absolute)”. 

I think the terms “Repeating” and “Absolute” are unique to Boomi and not a JSON terminology.  It wasn’t obvious to me what is the difference between them. However, I found the answer in the Boomi documentation “JSON profile’s Data Element tab” ...

Array (Repeating) - Used for an array that contains a repeating element. Identifier instances can be used with repeating arrays.
Array (Absolute) - Used for an array that contains a set of different elements, rather than a repeating element.

 

Still, the description above is not all that clear, so I though an example is in order …

 

Array (Repeating):

In many programming languages, an array can only store elements or objects of the same type. E.g. an array of integers (as in C), or an array of objects (as in Java or C#).  That is what Boomi means by “Array (Repeating)”.

Examples:

Array of numbers: [1, 2,3,4]

Array of product object: [ {upc: “123”, price:1.99}, {upc: “345”, price:2.99}, {upc: “456”, price:5.99} ]

 

Array (Absolute): 

Javascript, on the other hand, let you have arrays that contain mixed object types. For example the array below is valid and contain 3 elements of different types:

[  1, “Orange Juice”, {"upc": 123, "price": 1.99}  ]

The first element is a number, 1.

The second element is a string, “Orange Juice”.

The third element is an object, {upc:123, price:1.99}.

That is what Boomi calls “Array (Absolute”).

 

Hope this better explains the difference between Array Repeating and Absolute. I think it would be more obvious if Boomi change the labels to “Array (same type”) and “Array (mixed  types)”

Outcomes