Click here to Skip to main content
12,623,027 members (29,050 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C# 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 1:48am
Updated 9-Oct-12 2:45am
v3

1 solution

Rate this: bad
 
good
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.

[Update]
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.
  Permalink  
v2
Comments
Narra sreenu 9-Oct-12 7:02am
   
how to deserialise json object into two dimensional array.
Zoltán Zörgő 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
Top Experts
Last 24hrsThis month


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

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