Click here to Skip to main content
16,018,294 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Dear All,
i use JSON.NET v4.0.30319 to working with json
i have problems with special charecter,
am looking for build two functions in c# first one process my json body "process special charecters" and second return back the real json text

any idea about his function m can you help me for build it.

Regards
Posted
Updated 19-Oct-12 0:54am
v2
Comments
Sergey Alexandrovich Kryukov 19-Oct-12 13:21pm    
What character do you consider "special"? :-)
--SA
Ahmad Abou Hamdh 20-Oct-12 3:57am    
the special like ' " \n \t \b \r
Sergey Alexandrovich Kryukov 20-Oct-12 22:28pm    
I see nothing special about them...
--SA

There is no such problem:

Any character may be escaped. If the character is in the Basic Multilingual Plane (U+0000 through U+FFFF), then it may be represented as a six-character sequence: a reverse solidus, followed by the lowercase letter u, followed by four hexadecimal digits that encode the character's code point. The hexadecimal letters A though F can be upper or lowercase. So, for example, a string containing only a single reverse solidus character may be represented as "\u005C".


Please see:
http://en.wikipedia.org/wiki/JSON[^],
http://www.ecma-international.org/publications/standards/Ecma-262.htm[^],
http://tools.ietf.org/html/rfc4627[^].

And of course, use DataContract and System.Runtime.Serialization.Json.DataContractJsonSerializer:
Please see:
http://msdn.microsoft.com/en-us/library/ms733127.aspx[^],
http://msdn.microsoft.com/en-us/library/system.runtime.serialization.json.datacontractjsonserializer.aspx[^].

Please see my past answers to similar or related questions:
How can I utilize XML File streamwriter and reader in my form application?[^],
Creating property files...[^],
deseralize a json string array[^].

—SA
 
Share this answer
 
Comments
Ahmad Abou Hamdh 21-Oct-12 5:16am    
Thank you very much :)
Sergey Alexandrovich Kryukov 21-Oct-12 11:32am    
You are very welcome.
Good luck, call again.
--SA
You should be able to just use a DataContractJsonSerializer[^].

/ravi
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900