22
1
using System;
2
using Newtonsoft.Json;
3
using Newtonsoft.Json.Linq;
4
5
public class Program
6
{
7
public static void Main()
8
{
9
int orderNum = 5392;
10
string plant = "EPIC06";
11
string orderLines = "[{\"part\": \"00C2A\", \"lotNum\" : \"\", \"orderLine\": 1, \"orderRelNum\": 1, \"warehouse\": \"CHI\", \"bin\": \"01-01-01\", \"qty\": 10, \"uom\": \"EA\"},{\"part\": \"001MP\", \"lotNum\" : \"\", \"orderLine\": 2, \"orderRelNum\": 1, \"warehouse\": \"CHI\", \"bin\": \"00-00-09\" , \"qty\": 10, \"uom\": \"EA\"},{\"part\": \"00C1\",\"lotNum\" : \"\", \"orderLine\": 3, \"orderRelNum\": 1, \"warehouse\": \"CHI\", \"bin\": \"00-00-00\" , \"qty\": 10, \"uom\": \"EA\"}]";
12
JArray parsedOrderLines = JsonConvert.DeserializeObject<JArray>(orderLines);
13
foreach (JObject line in parsedOrderLines)
14
{
15
Console.WriteLine("Parsed order line:");
16
Console.WriteLine("part:");
17
Console.WriteLine(line["part"]);
18
Console.WriteLine("Quantity:");
19
Console.WriteLine(line["qty"]);
20
}
21
}
22
}
Cached Result
Value of age is 25