parsing Json in .NET
{ "posOrder":
{ "No": 1234,
"Operator": 18,
"ECR-Name": "Im开发者_StackOverflow社区bissbude ",
"Receipt": {
"PLUs": [
{ "Number": 31, "Name": "Pommes", "Price": 150, "Qty": 2 },
{ "Number": 112, "Name": "Coke", "Price": 200, "Qty": 1 } ]
}
}
}
this is my json script. i want to get each field and its value if only the class name="posOrder". ie find filed"no" and its value, field plus and its inner fileds and values. etc.
This library can help you with that: Json.NET And then you can use LINQ to find things: Example
Another option is Microsoft's System.Web.Extensions.dll. There is a JSON parser in the System.Web.Script.Serialization namespace.
精彩评论