Skip to main content
Level 2
Jan 26, 2024 5:57 PM UTC
Solved

Aem 6.5 | quotes inside json .. making it invalid json

In my excel sheet- one of the field is having value - ram and adam are a sensible, They have their weekly "play date."

I am trying to convert excel data into json in my java code. Here below is json

 

{

    "ID": "9.0",

    "Description": "ram and adam  are a sensible,  They have their weekly "play date."",

    "Genre": "Comedy"

}

But if i try to validate this json this is invalid bcoz of “play date” inside value of description field. Bcoz json itself have quotes n braces. What should i do now to create a valid json

I tried some regex but did not work

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
narendragandhi
narendragandhiAccepted solution
Community Advisor
Jan 29, 2024 4:01 PM UTC

Hi @sumansatija4 

 

There are multiple recommended way to escape double quotes in JSON. Please refer the below link for the same -

 

https://www.baeldung.com/java-json-escaping

 

Thanks

Narendra

2 replies

narendragandhi
Community Advisor
narendragandhiCommunity AdvisorAccepted solution
Community Advisor
Jan 29, 2024 4:01 PM UTC

Hi @sumansatija4 

 

There are multiple recommended way to escape double quotes in JSON. Please refer the below link for the same -

 

https://www.baeldung.com/java-json-escaping

 

Thanks

Narendra

Translate
EstebanBustamante
Adobe Champion and Community Advisor
Adobe Champion and Community Advisor
Jan 30, 2024 1:00 PM UTC

You would need to fix this manually, you can use something like JsonValidator to find for you all the instances the JSON format is breaking. https://jsonformatter.curiousconcept.com/ 

 

Hope this helps.

Translate
Esteban Bustamante