Hi,
I have the following JSON data that I would to transform into the following data:
[{“id”:16,“name”:“Animation”},{“id”:10751,“name”:“Family”}]
into
Animation, Family.
Parsing methods I found online only show Animation.
Hi,
I have the following JSON data that I would to transform into the following data:
[{“id”:16,“name”:“Animation”},{“id”:10751,“name”:“Family”}]
into
Animation, Family.
Parsing methods I found online only show Animation.
Your JSON contains a collection, so you need to extract it across multiple rows.
Add enough rows to cover the maximum number of items, number the rows beginning at zero, and use the following JavaScript:
const json = JSON.parse(p1);
return json[p2].name;
Thank you, but that’s not exactly what I am looking for.
Each row has its own JSON data, so I was looking to have “Animation, Family” in a single cell.
I found this solution, but I am not able to pass p1 as a value:
var data = p1
var result = data.map(function(val) {
return val.name;
}).join(', ');return (result)
Okay, if you want a comma separated list on a single line, then here is a version of your code that will work:
const json = JSON.parse(p1);
const result = json.map(function(val) {
return val.name;
}).join(', ');
return result;
Here’s my alternative using the new Query JSON column.
$join(name,", ")
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.