我使用的是Newtonsoft.Json.Net40。当我将以下XDocument转换为Json时,将返回后续的Json。
< lsems-Response version="1.0.0" > < lsems-Status statusCode="000" statusText="Success" >Store Data Request accepted.< /lsems-Status > < lsems-StoreDataResponse >< /lsems-StoreDataResponse > < / lsems-Response > {"?xml": {"@version":"1.0","@encoding":"UTF-8"}, "lsems-Response": { "@version":"1.0.0","lsems-Status": {"@statusCode":"000","@statusText":"Success","#text":"Store Data Request accepted."}, "lsems-StoreDataResponse":"" } }
这是我的代码:
Public Sub ConvertXDocToJson()
jsonOut = JsonConvert.SerializeObject(xmlOut)
End Sub
jsonOut充满了上面的json。
如何在每个属性之前删除@和#?