Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: parsing JSON for specific entries

by suaveant (Parson)
on Aug 01, 2012 at 19:04 UTC ( #984876=note: print w/ replies, xml ) Need Help??


in reply to parsing JSON for specific entries

{ denotes a hash, [ denotes array, just like in Perl. You are trying to iterate through $object->{Content_ID} by dereferencing it as an ARRAY but it is a hash, with keys CNBP_021687, CNBP_021688 and CNBP_021691. The correct way to iterate would be:

foreach $key (keys %{$object->{Content_ID}} ){ my $item = $object->{Content_ID}{$key}; print " do nothing \n"; };

                - Ant
                - Some of my best work - (1 2 3)


Comment on Re: parsing JSON for specific entries
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://984876]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (17)
As of 2015-07-28 18:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (258 votes), past polls