go ahead... be a heretic | |
PerlMonks |
Build JSON With Perlby srchulo (Sexton) |
on Nov 11, 2011 at 06:25 UTC ( [id://937530]=perlquestion: print w/replies, xml ) | Need Help?? |
srchulo has asked for the wisdom of the Perl Monks concerning the following question: Hi all, I am trying to build JSON such as this with Perl: [{"name":"picture1.jpg","size":902604,"url":"\/\/example.org\/files\/picture1.jpg","thumbnail_url":"\/\/example.org\/thumbnails\/picture1.jpg","delete_url":"\/\/example.org\/upload-handler?file=picture1.jpg","delete_type":"DELETE"},{"name":"picture2.jpg","size":841946,"url":"\/\/example.org\/files\/picture2.jpg","thumbnail_url":"\/\/example.org\/thumbnails\/picture2.jpg","delete_url":"\/\/example.org\/upload-handler?file=picture2.jpg","delete_type":"DELETE"}]Essentially it is JSON array of JSON objects. However, I am not finding any good tutorials online. Does anyone have any suggestions? Currently I am using the JSON::XS module to decode, but I'm open to anything as long as it works. Currently I have this code:
Only problem is that it creates this: {"lool":"WEEEE","YAY":"WEEEE","HASH(0x8b8410)":null}Which also include the hash reference itself in it. Any help would be appreciated! Many Thanks,
Back to
Seekers of Perl Wisdom
|
|