I have a chat application where user can enter any string in textbox like - json string, XML string or normal string/text. I am storing this string/data into database.
Now I have to show that data (chat details) in a JSON format. But my problem is as user can enter any data/string in chat application so if user enter's any JSON string in invalid JSON format then my final output/result (which is in JSON format) is not generated due to this.
Can anyone help me out to resolve this ?
I am working on C#, SQL Server and JQuery.
My final output will be like this:
"[
{"Key":"A", "Value":"xyz"},
{"Key":"B", "Value":"6"},
{"Key":"C", "Value":"{"Email":"abc@gmail.com", "Address":"Park ROad"}"}
]"
There is a problem in third row (where Key is "C"). Means user has entered the JSON string and that may be valid or invalid.