Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

JSON and Perl Objects - How to access data?

by harryhalpin (Initiate)
on Nov 18, 2007 at 22:15 UTC ( [id://651544]=perlquestion: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    {
        "items" : [
    ...
             }
            ]
    }
    
  2. or download this
    $inventors_obj = jsonToObj($inventors_json[0]);
    
    #I want to iterate through my list of inventors
    @inventors_array = $inventors_obj->{"items"};
    
  3. or download this
    #print name doesn't work, because the entire object is #stored at $inv
    +entors_array[0].
    print $inventors_array[0]->{"name"}
    ...
    $inventors_array[1]->{"name"} = "New Name";
    #But I can do with an array of hashes...
    $inventors_array[1]{"name"} = "New Name";
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://651544]
Approved by ww
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2024-04-24 21:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found