How to decode a JSON string?

后端 未结 4 662
名媛妹妹
名媛妹妹 2021-01-21 10:39

On the server side do I have 2 hashes I encode into JSON strings like so

my $j = JSON->new;
$j = $j->utf8;

my $data;
$data->{users}  = $j->encode(\\         


        
4条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-21 11:25

    You don't need to turn it into an array. According to the jQuery.each() documentation it takes both arrays or objects and JSON is a subset of the object literal notation of JavaScript.

    Edit: Here's an example: http://jsfiddle.net/pedrocorreia/s5UrZ/2/

提交回复
热议问题