Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: C#4.0
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.
Posted 9-Oct-12 0:48am
Edited 9-Oct-12 1:45am

1 solution

Rate this: bad
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.
Narra sreenu at 9-Oct-12 7:02am
how to deserialise json object into two dimensional array.
Zoltán Zörgő at 9-Oct-12 7:30am
See my update

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

  Print Answers RSS
0 OriginalGriff 375
1 Sergey Alexandrovich Kryukov 170
2 CHill60 160
3 RyanDev 135
4 Richard MacCutchan 115

Advertise | Privacy | Mobile
Web04 | 2.8.140709.1 | Last Updated 9 Oct 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid