Convert JSON string to C # string array

Using JSON.Stringify I am passing the following string inside another Stringify object.

[
    [
        "I-000-4310-000",
        "Convention Registration",
        "59.99"
    ],
    [
        "I-000-4311-000",
        "Convention Breakout",
        "39.99"
    ]
]

      

In my C # web service, I need to split a string into an array of strings that looks like this:

 string[, ,] GLCodes = new string[,,] 
 { 
    {
        { "I-000-4310-000", "Convention Registration", "59.99" }, 
        { "I-000-4311-000", "Convention Breakout", "9.99" }
    } 
 };

      

What's the easiest way to do this?

+3


source to share


1 answer


Using Json.NET you can deserialize this list with this

string[][] strings = JsonConvert.DeserializeObject<string[][]>(jsonData);

      



Hope this helps!

+2


source







All Articles