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

Json output format issue : [via TidyJSONWriter] in search servlet AEM 6.3

Avatar

Level 8

Hi All,

We have a custom servlet, to return the list of search results[attributes stored as part of custom page properties ] in json format. For one of the multifield (of pathbrowser's ) field in dialog, value in the crx is saved as

customImage : String[] : {"customImageName":"/content/dam/imageone.jpg"}

                        {"customImageName":"/content/dam/imagetwo.jpg"}.

But in the json[json section corresponding to that attribute is given below ] that is generated[TidyJSONWriter is used ], it is in the form of

"customimage": [

          "{\"customImageName\":\"/content/dam/abcd.jpg\"}"

        ],

We are using this json data to populate data on the page[via ajax call to the custom servlet].

Few clarifications :

1] In the crx, the data stored is proper. Shouldn't the json output be in a similar format as stored in the crx?

2] Is it because we are using TidyJSONWriter, the crx values for multifield are outputted in a different format?

3] We are able to access other attribute values, but facing issues reading this attribute value.

4] Any pointers/reference code/snippet on how do we read this properrty value in js and display on the page. Any thoughts on this will be really helpful.

5 Replies

Avatar

Level 8

Hi,

Also, as per Second level multifieldpanel · Issue #380 · Adobe-Consulting-Services/acs-aem-commons · GitHub  using coral multifield should fix the issue. Tried using coral multifield and hit page.infinity.json , but still the same[stored as an encoded string].

Any pointers on this will be helpful.

Avatar

Employee Advisor

Looks like the double quotes (which are storted in the repo) are escaped.

Avatar

Level 8

Hi Jorg,

Thank you for your reply.

Any pointers/thoughts on how to avoid this, will be helpful.

Avatar

Community Advisor

Hi

  We are using Jackson API for out project Maven Repository: com.fasterxml.jackson  . May be this will help.

Thanks

Veena