Monday, August 27, 2012

arrays – Javascript JSON stringify No Numeric Index to include in Data

i am trying to pass non numeric index values through JSON but am not getting the data.



var ConditionArray = new Array();
ConditionArray[0] = \"1\";
ConditionArray[1] = \"2\";
ConditionArray[2] = \"3\";

ConditionArray[\'module\'] = \"Test\";
ConditionArray[\'table\'] = \"tab_test\";
var Data = JSON.stringify(ConditionArray);


When i alert the Data Variable it has the Values 1,2 and 3 but module and table are not included. How can this be added so that the whole string is passed.


EDIT : And what if i have some multidimensional elements also included like




ConditionArray[0] = new Array();
ConditionArray[0] = \"11\";






Rating: 5 out of 5 based on 6 ratings



The post arrays – Javascript JSON stringify No Numeric Index to include in Data appeared first on Javascript ASK.






via Javascript ASK http://javascriptask.phpfogapp.com/arrays-javascript-json-stringify-no-numeric-index-to-include-in-data.html

No comments:

Post a Comment