0
内新线我一直在使用Json.NET连载我的内存中的对象,以JSON。当我把下面的代码行:解析JSON场
string json = JsonConvert.SerializeObject(template, Formatting.Indented);
System.IO.File.WriteAllText(file, json);
我得到了一个文本文件中的以下内容:
{
"template": {
"title": "_platform",
"description": "Platform",
"queries": [
{
"query": "// *******************************\n// -- Remove from DurationWindow at the end \n// *******************************\t\n"
}
],
"metadata": ""
}
}
查询是一个对象,我掏出数据库,具有字符串值。当我使用XML和写入文件(使用的XDocument),字符串(还有\ t)将在新线正确解析到文件选项卡和新的生产线。是否有可能与json.Net这里得到同样的效果?