0

I don't know how to deserialize this json string:

[ [ [ "JR10", "Test1", 142, 199, 66 ], [ "JR10", "Test2", 142, 199, 66 ] ] ]

into an array inside an array.

for example: messages[0] would contain an array containing "JR10", "Test1", 142, 199, 66 messages[0][0] would contain the string "JR10"

0

2 Answers 2

1

I don't know how to deserialize this json string:

Normally when you want to deserialize a JSON string to an object you use a JSON serializer. For example using the build in JavaScriptSerializer class:

var json = "[ [ [ \"JR10\", \"Test1\", 142, 199, 66 ], [ \"JR10\", \"Test2\", 142, 199, 66 ] ] ]";
var serializer = new JavaScriptSerializer();
var result = serializer.Deserialize<object[][][]>(json);
Console.WriteLine(result[0][0][0]); // "JR10"
Console.WriteLine(result[0][0][1]); // "Test1"
Console.WriteLine(result[0][1][0]); // "JR10"
Console.WriteLine(result[0][1][1]); // "Test2"
...
Sign up to request clarification or add additional context in comments.

Comments

0

There is an object that can deal with serialising and desierialising:

System.Web.Script.Serialization.JavaScriptSerializer

Code similar to this should achieve what you want.

JSONSerializer = new System.Web.Script.Serialization.JavaScriptSerializer();

Array[][] anArray = JSONSerializer.Deserialize<Array[][]>(JSON);

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.