Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^7: JSON module

by LTjake (Prior)
on Aug 16, 2007 at 11:54 UTC ( #633012=note: print w/replies, xml ) Need Help??


in reply to Re^6: JSON module
in thread JSON module

@output should be an array of hashrefs.

while ( my $row = $sth->fetchrow_hashref ) { my %data; $data{ col1 } = 'bar'; push @output, \%data; }

Then converting it to JSON will make it look something like (i've added some formatting):

{ "myData" : [ { "col1" : "bar" }, { "col1" : "bar" }, # etc ... ] }

HTH.

--
"Go up to the next female stranger you see and tell her that her "body is a wonderland."
My hypothesis is that she’ll be too busy laughing at you to even bother slapping you.
" (src)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://633012]
help
Chatterbox?
[Discipulus]: LA something a little more perlish? @mts = map {qx!mp3info -p $_!} glob '/path/*.mp3 (hazarded code)
[Discipulus]: many monks want to be hired tonight, other haired and some aired
[Lady_Aleena]: Discipulus, do glob recurse?
[Lady_Aleena]: s/do/does/;

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (9)
As of 2017-04-23 20:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I'm a fool:











    Results (432 votes). Check out past polls.