c# - Newtonsoft.Json returning '\' character -


i´m using newtonsoft.json library serialize object. problem when create json string, comes '\' character. i´ve seen answers said debugger issue, i'm getting json '\' client consuming service. tried remove chacater function seems happening exact same stringbuilder.

private static string datatabletojson(datatable dt) {     string jsonresult;     jsonresult = jsonconvert.serializeobject(dt, formatting.none);     return jsonresult; } 

and i´m getting:

"[{\"id\":\"72d209d5-0028-4162-94d0-d8cae856e1b7\",\"username\":\"nicolas\",\"nombre\":\"asd\"},{\"id\":\"8ecdd5eb-b6a8-40f7-87a6-28ae39d5924c\",\"username\":\"mario\",\"nombre\":\"asd\"},{\"id\":\"c48d2d27-40af-4bfe-a912-a18689c70076\",\"username\":\"diego\",\"nombre\":\"asd\"}]"

can me this?. driving me crazy!.

thanks.

it's escape character.in string, can see backslash escape characters.you can run that's code.

jsonresult.tostring(); 

the output didn't include "\".


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -