0

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.

stuartd
  • 70,509
  • 14
  • 132
  • 163
GreenSoft
  • 41
  • 1
  • 4
  • 12

1 Answers1

0

You can use a Dynamic object in this link you will fine good explained. How to use it.

Community
  • 1
  • 1
Zaher88abd
  • 448
  • 7
  • 20