C# 如何反序列化Json多个结果?
我有如下字符串(一个字符串变量中有两行),如何在C中使用JsonConvert类将其分成两个字符串并进行反序列化#C# 如何反序列化Json多个结果?,c#,C#,我有如下字符串(一个字符串变量中有两行),如何在C中使用JsonConvert类将其分成两个字符串并进行反序列化# 您可以使用新行分隔符将字符串拆分为字符串数组,然后JSON反序列化每一行。要拆分字符串,可以使用以下方法 例如: string input = "... your input string ..."; string[] lines = input.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyE
您可以使用新行分隔符将字符串拆分为字符串数组,然后JSON反序列化每一行。要拆分字符串,可以使用以下方法 例如:
string input = "... your input string ...";
string[] lines = input.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
foreach (string line in lines)
{
// you could use a JSON serializer here to deserialize the line
// and possibly add it to some result collection
}
string input = "... your input string ...";
string[] lines = input.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
foreach (string line in lines)
{
// you could use a JSON serializer here to deserialize the line
// and possibly add it to some result collection
}