Forum Discussion
Try two Mappers, one to map the fields of the root object, then another with Mapping Root set to the array. That will let you map the elements of that array, and pass through the root object from the first Mappers.
I’ve tried that but it causes the same issue as with one mapper.
The elements of the subarray still get combined instead of being mapped to separate arrays.
The issue is really that the subarray is an array of arrays, which I’d like to reproduce. Instead the mapper produces elements, each of wich contains an array of all of one type of subvalue from the different subarrays in the input.
Sorry I just noticed that the formating in the JSON didn’t survive copying which doesn’t help make that obvious.
- ptaylor5 years agoEmployee
Yes, I’m not seeing any nested arrays in the JSON input or output you posted, except for the one where you’re saying that this isn’t what you want. Try posting the input and desired output with the Preformatted Text feature in the editor (icon looks like </>). That will also prevent the double quotes from getting inserted as left/right versions like in English text, which is invalid JSON.
[ {"name": "value"}, {"name", "value"} ]- ptaylor5 years agoEmployee
Did you still need help with this?
- MarotReply5 years agoNew Contributor II
I haven’t yet found a solution, so yes.
Also here are the formatted JSONS:Received JSON:
{ "Property1":"value1", "Property2":"value2", "Property3":"value3", "Subarray":[ { "SubProperty1":"subValue1", "SubProperty2":"SubValue2", "SubProperty3":"SubValue3" }, { "SubProperty1":"subValue4", "SubProperty2":"SubValue5", "SubProperty3":"SubValue6" } ] }Should be Produced JSON:
{ "Prop1":"value1", "Prop2":"value2", "MyArray":[ { "SubProp1":"subValue1", "SubProp2":"SubValue2", }, { "SubProp1":"subValue4", "SubProp2":"SubValue5", } ] }I have found that I can manipulate the subArrays by using a JSON splitter and working on each one individually, I have not however found out how to use the join snap to properly put them back into the required space once this is done.