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.
When i tried with below logic i get output as follow:
jsonPath($.mapValues((value, key) => { ALNVALUE: parseFloat(value) || value, ASSETSTTRID:key}), “$*”)
which is not completely correct, i want highlighted assetnum, siteid, classstructureid outside the json path as mentioned in mapper snap.
Seems like i am missing somewhere a bit.
$.mapValues((value, key) => key==‘IsCritical’ || key==‘maoup’ || key==‘diame’?{AnnalValue:value,ASSETSTTRID:key} : “”).values().filter(x=>x!=“”)
Ignore the field names. Sample_2020_09_02.slp (3.7 KB)
Related Content
- 3 months ago
- 10 months ago
- 3 years ago
- 5 years ago