Click here to Skip to main content
15,214,922 members
Rate this:
Please Sign up or sign in to vote.
See more:
Hi All,

I have a two dimensional array in java script like
var exArray = [[2, 3], [3, 4], [5, 6]];

These array values are stored in a hidden variable using json object.
document.getElementById("hdnArray").value = JSON.stringify(exArray);

In Code side,
the hidden variable value return as "[[2, 3], [3, 4], [5, 6]]".

Now I want to convert these hidden variable value into two dimensional array without using spliting operation.
Updated 9-Oct-12 1:45am

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

If it is json encoded, you can use the same approach in c# also. Use a json deserializer.

Depending on what you want to do with it, a simple method is using FastJson[^] for example:
var newobj = fastJSON.JSON.Instance.Parse(@"[[2, 3], [3, 4], [5, 6]]");

You will get a List<list<object>> where every element will be an Int64. I am not sure, that converting this to array is really necessary.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100