我现在有个序列化的字符串:
Object json=JsonConvert.SerializeObject(dic);
json字符串是这样的:
{“parameter”:"{“billcode”:“820010117905”}"}
请求需要的格式是这样的:
{“parameter”:{“billcode”:“820010117905”}}
所以我得去掉json字符串中的多余的\以及引号,
这么做:
//删除第十三位后面的第一位字符,下同
string jsons = json.Remove(13, 1);
string jsons1 = jsons.Remove(jsons.Length - 2, 1);
string jsons2 = jsons1.Remove(14, 1);
string jsons3 = jsons2.Remove(23, 1);
string jsons4 = jsons3.Remove(25, 1);
string jsons5 = jsons4.Remove(json4s.Length-4, 1);
得到的格式就是我想要的东西拉。