How to get each item of multifield in the form of json | Community
Skip to main content
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Suraj_Kamdi
Suraj_KamdiAccepted solution
New Participant
Jul 13, 2023 5:45 AM UTC

Use the following code snippet.

 

@ValuemapValue
private Collection<Pojo> multifieldResourceName = Collections.emptyList();

//logic goes here
ObjectMapper mapper = new ObjectMapper();
mapper.writeValueAsString(multifieldResourceName );

3 replies

Anudeep_Garnepudi
New Participant
Jul 29, 2023 1:50 PM UTC

@anamikap 

Get each multifiled item ValueMap and use Gson to conver ValueMap to JSON.

String jsonStr = gson.toJson(valueMapObj)
Translate
Level 4
Jul 13, 2023 6:02 AM UTC

hi @anamikap ,

Hope you have already found the answer for the above question. There are multiple ways to fetch Json Object. Below is one of the options

 

Translate
Suraj_Kamdi
Suraj_KamdiAccepted solution
New Participant
Jul 13, 2023 5:45 AM UTC

Use the following code snippet.

 

@ValuemapValue
private Collection<Pojo> multifieldResourceName = Collections.emptyList();

//logic goes here
ObjectMapper mapper = new ObjectMapper();
mapper.writeValueAsString(multifieldResourceName );
Translate