Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.
SOLVED

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

Avatar

Level 2

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

1 Accepted Solution

Avatar

Correct answer by
Level 8

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

View solution in original post

2 Replies

Avatar

Correct answer by
Level 8

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

Avatar

Community Advisor

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.



Esteban Bustamante