c# handle single double quote in the string(json) -


i'm using c# handle json format parse data , have encountered situation kind of json:

"{"imperial":" 54 1/4" "}" 

as can see there's inch symbol(double quote) after

1/4 

that leads me error. how can handle double quote?

i'm using newtonsoft.json parse json , tried many ways such replacing " ' gives me same error.

i thought regex maybe? suggestions?

thanks!

code (for string <number>/<number><double quote>):

string json = "{\"imperial\":\" 54 1/4\" \"}"; string convertedjson = regex.replace(json, @"(\d+\/\d+)""", "$1\\\"");  var res = newtonsoft.json.jsonconvert.deserializeobject(convertedjson); 

result (convertedjson):

{"imperial":" 54 1/4\" "} 

Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -