I am using object-mapper to transform a JSON object to a different JSON format. The following works... but only produces the first entry in the JSON I have. Is there some sort of foreach or iteration that needs to be added?
This:
var src = response.data;
var map = {
"value.segments.start": "value.start",
"value.segments.end": "value.end",
"value.segments.segments.performanceCounters/processCpuPercentage.avg": "value.cpu"
};
var dest = objectMapper(src, map);
res.send(dest);
But here is my response.data as I get JSON from one source and need to transform it to another format, as you can see multiple entries and I expected to multiple entries in the object-mapped output:
I am using object-mapper to transform a JSON object to a different JSON format. The following works... but only produces the first entry in the JSON I have. Is there some sort of foreach or iteration that needs to be added?
This:
Produces this:
But here is my response.data as I get JSON from one source and need to transform it to another format, as you can see multiple entries and I expected to multiple entries in the object-mapped output: