Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

issue with json data for composite field in content fragment

Level 1
Level 1

Implemented composite multifield. 


Need the array to be json array than string array.


issue json coming as String Array

0 "{\"linkName\":\"test\",\"linkUrl\":\"test\"}"
1 "{\"linkName\":\"test\",\"linkUrl\":\"test\"}"


expected as json array as below.

0 {\"linkName\":\"test\",\"linkUrl\":\"test\"}
1 {\"linkName\":\"test\",\"linkUrl\":\"test\"}

1 Reply
Community Advisor
Community Advisor

Hi @O703980 


The String Array that you have mentioned is a valif JSON whereas the expected JSON array you mentioned is not a valid JSON.


do you mean by:

[{\"linkName\":\"test\",\"linkUrl\":\"test\"}, {\"linkName\":\"test\",\"linkUrl\":\"test\"}]


"[{\"linkName\":\"test\",\"linkUrl\":\"test\"}, {\"linkName\":\"test\",\"linkUrl\":\"test\"}]"


If that's the case you can use the Gson API.


String x = input;
Gson gson = new Gson();
String toJson = gson.toJson(x);