02-08-2024 03:44 PM
Good evening,
I have an array of elements that I'd like to output as JSON:
[{...},{...},{...}]
In order to nest this array under a JSON property, I utilize the "Group by N" snap, which results in my data looking like this:
{
"randomKey": [{...},{...},{...}]
}
This is passed into a JSON formatter. Upon looking at the output JSON however, it appears that what I'm actually getting is this:
[{
"randomKey": [{...},{...},{...}]
}]
How can I configure the JSON formatter to not nest my response in an array? Why is it happening?
02-09-2024 01:29 AM
Also, another way of nesting the array under a JSON property is by using a Mapper Snap.
About the formatting of the JSON, check the "Format each document" checkbox.
02-09-2024 04:08 AM
@mccoleman - or you leave your JSON documents at the root level and use the JSON Formatter with default configuration (I use Pretty-print just to make it easier to read).
Hope this helps!