Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How To Convert JSON String That Contains Encoded Unicode

Could anyone tell me how to convert the following json object string, which contains encoded unicode characters (Chinese in this case) to human readable one using c# in asp.net?

records:[{"description":"\u849c\u8089","id":282}]

The string is submitted via Ajax from an Ext JS web application.

Any help is much appreciated.

like image 493
Wong Gut Avatar asked Sep 18 '11 09:09

Wong Gut


1 Answers

There is no need to convert this string in any special manner. Any JSON decoder that more or less sticks to the specification will automatically create a correct string for the description attribute.

Update:

However, your current sample is not valid JSON. It's missing brackets or braces around the complete sample and it's missing double qutoes around records.

A correct JSON snippet would be:

{"records":[{"description":"\u849c\u8089","id":282}]}

Giving:

  • records:
    • []
      • description: 蒜肉
      • id: 282
like image 65
Codo Avatar answered Sep 25 '22 17:09

Codo