Tuesday, 15 May 2012

json - SerializeObject adds unicode c# -



json - SerializeObject adds unicode c# -

i have wcf service returns database tables in json format. seralizeobject adds unicode httpresponse, how can remove this?

code:

using (var db = new newtestdbcontext()) { var query = b in db.roads orderby b.roadid select b; road rr = query.first(); var serializersettings = new jsonserializersettings { preservereferenceshandling = preservereferenceshandling.objects }; homecoming jsonconvert.serializeobject(rr, formatting.indented, serializersettings);

reponse:

"{\u000d\u000a \"$id\": \"1\",\u000d\u000a \"roadparts\": [\u000d\u000a {\u000d\u000a \"$id\": \"2\",\u000d\u000a \"road\": {\u000d\u000a

responseformat = webmessageformat.json

that json encode homecoming value of annotated method. if homecoming value json string, json encoding twice.. first road object , json string resulting former.

so homecoming road object , allow webmessageformat.json handle json encoding.

c# json unicode entity

No comments:

Post a Comment