Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]
Created 12-17-2018 03:04 PM
I have a json input which structure is as follows:
[
{
"line": [
{
"element1": 4.908278133674332,
"element2": 45.8293948360587
},
{
"element1": 4.90838573779603,
"element2": 45.82938855483125
}
],
"coord": 1749,
"xenius": "LYO01749",
"label": "R M. BASTIE",
"date": "2018-12-17"
},
{
"line": [
{
"element1": 7.908278133674332,
"element2": 8.8293948360587
},
{
"element1": 4.555,
"element2": 42.34534
}
],
"coord": 223,
"xenius": "LYO01749",
"label": "R M. BASTIE",
"date": "2018-12-17"
}
]And I would like to convert it into a list of json elements. Something like:
{
"line": [
{
"element1": 4.908278133674332,
"element2": 45.8293948360587
},
{
"element1": 4.90838573779603,
"element2": 45.82938855483125
}
],
"coord": 1749,
"xenius": "LYO01749",
"label": "R M. BASTIE",
"date": "2018-12-17"
}
{
"line": [
{
"element1": 7.908278133674332,
"element2": 8.8293948360587
},
{
"element1": 4.555,
"element2": 42.34534
}
],
"coord": 223,
"xenius": "LYO01749",
"label": "R M. BASTIE",
"date": "2018-12-17"
}How could I do that with a json or jolt transformation, and not using SplitRecord?
Please note that I just want to get all the elements of the array and output them as a list of json elements, without the parent array.
Thanks in advance.
Created 12-17-2018 06:37 PM
You can use ConvertRecord for this, your JsonRecordSetWriter would have its Output Grouping property set to "One Line Per Object". The individual objects won't be pretty printed in the output as you have above, but it will remove the array braces as well as the comma delimiter, and just output each element of the above array as a JSON object on its own line.
Created 12-17-2018 06:37 PM
You can use ConvertRecord for this, your JsonRecordSetWriter would have its Output Grouping property set to "One Line Per Object". The individual objects won't be pretty printed in the output as you have above, but it will remove the array braces as well as the comma delimiter, and just output each element of the above array as a JSON object on its own line.
Created 12-18-2018 08:45 AM
Output Grouping... magical property 🙂
That did the trick. Thanks a lot Matt!