in reply to json::xs arrays

my $email = $response->{data_info}{del_info}[0]{email}[0];

or, if there are more than one,

my @emails = @{ $response->{data_info}{del_info}[0]{email} };

and if there are more than one del_info's:

my @emails = map @{ $_->{email} }, @{ $response->{data_info}{del_info} + };

($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,

Replies are listed 'Best First'.
Re^2: json::xs arrays
by bigup401 (Pilgrim) on Mar 29, 2017 at 14:19 UTC

    it only parse email not accessing other data in array

    its the problem i was facing

    { "data" : "status", "data_info" : { "info" : "user", "deluser" : [ { "names" : "john doe", "age" : 28, "location" : [ { "country" : "ca", } ], "email" : [ "john@email.com" ], "cf" : 1.0, "pr" : null } ] } }

      Note that the JSON string you present in this post is different from the one presented in the OP and so does not match with choroba's code here. Is
          "del_info" : [ ... ]
      or
          "deluser" : [ ... ]
      correct? (Everything else seems the same.)

      Update: Another link that might be helpful in dealing with the complex data structures that can be produced by JSON parsing is the Perl Data Structures Cookbook (or perldsc).


      Give a man a fish:  <%-{-{-{-<