Cause analysis and solution of double quotation marks always appearing in C parsing json string

  • 2021-09-11 21:06:57
  • OfStack

json has not been used for a long time. Today, when json is used, it is found that there are always double quotation marks when parsing strings.

The code is as follows:


string jsonText = "{'name':'test','phone':'18888888888'}";
JObject jo = (JObject)JsonConvert.DeserializeObject(jsonText);
string zone = jo["name"].ToString();
string zone_en = jo["phone"].ToString();

The ones taken out are "test" and "18888888888", which can't be studied for a long time.

Because I used Newtonsoft. Json, I downloaded the latest version in official website and found that the value was correct. I took test, 1888888888

The analysis reason can be the version problem. Before using 1 straight is Newtonsoft. Json. Net 20, now the program framework is. net 4.0. The latest version downloaded has compiled files for all versions of. net, which is very good.

About C # parsing json string always more than double quotation marks reason analysis and solutions This site to introduce so much to you, I hope to help you!


Related articles: