php - jQuery json_encode -


i've looked around javascript/jquery function emulates php's json_encode, ones find (listed bellow) don't work.

  1. http://code.google.com/p/jquery-json/
  2. http://phpjs.org/functions/json_encode:457

to check if wasn't array wasn't faulty used phpjs var_dump expected results.

can point me in right direction?

the problem cannot this:

ret[$(this).attr("id")] = _recursiveitems(this); 

because var ret = [] declares ret array , not object , $(this).attr("id") non-numeric (its value head_1). attempting create associative array not supported.. javascript associative arrays are meant numeric , considered harmful.

if change declaration var ret = {} can use jquery-json convert object json. here demo using code in question.


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -