我最后的问题JSON.NET:C#JSON.NET去除串用“”
我的文件包含了一些在这里的那些家伙:
{
"type": "06A, 06B, 06C, 06D, 06E",
"qt": "6-8-",
"id": "06A, 06B, 06C, 06D, 06E6-8-"
}
现在我想清理我的文件并删除所有类型包含逗号或“,”的对象。
我已经阅读:C# remove json child node using newtonsoft但没有可能性,如果它包含一个特殊的字符去掉对象...
我真的很感激任何帮助!
目前我有:
public void filter()
{
string sourcePath = @Settings.Default.folder;
string pathToSourceFile = Path.Combine(sourcePath, "file.json");
string list = File.ReadAllText(pathToSourceFile);
Temp temporaray = JsonConvert.DeserializeObject<Temp>(list);
}
你是什么*块意味着*?什么是预期的输出json?你试过什么了? –
对不起,“块”我的意思是整个对象包含类型,qt和id – Francis
反序列化成对象并用'Where'过滤。然后你可以重新序列化为json,如果你需要的话。 – SimpleVar