Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Thanks for your response, Please check my Json data one more time. This is an example. There will be 30000 data like this and i am suspecting one of the records creating an issue which JSON response had some issue, The users records under {}, under [] Its not line specific but a record under {}, under []. Will your above code works for each users JSON response? The JSON responses hold by $responsetextall[$i]

[ { 'status' => 'ACTIVE', 'activated' => '2020-04-29T17:58:43.000Z', 'created' => '2020-04-29T17:58:42.000Z', '_links' => { 'self' => { 'href' => 'https://ssoqa.abcoffi +ce.com/api/v1/users/abcdefghijklmno55' } }, 'passwordChanged' => undef, 'lastUpdated' => '2020-11-06T19:09:08.000Z', 'id' => '00abcdefghijklmn6', 'lastLogin' => '2020-10-05T15:16:53.000Z', 'profile' => { 'email' => 'soula.olla@abc.com', 'middleName' => 'Y', 'countryCode' => 'IN', 'login' => '123456789@ADSYF.SYFBANK.COM', 'streetAddress' => '14-45,idhaian', 'organization' => 'ABC Organization', 'employeeNumber' => '123456789', 'division' => 'ABC - IT', 'AWSrole' => [], }, 'type' => { 'id' => 'omstdyc' }, 'credentials' => { 'provider' => { 'type' => 'AD', 'name' => 'AD.COM' } }, 'statusChanged' => '2020-06-01T08:56:35.000Z' }, { 'id' => '00mnopqrstq6', 'lastLogin' => ${\$VAR1->[0]{'passwordChanged'}}, 'profile' => { 'managerId' => '2456789', 'userType' => 'Contract', 'city' => 'Stamford', 'zipCode' => '00009', 'JobFunction' => 'IT', 'manager' => 'Kal, R', 'department' => 'IT - IN - CS&T - Client Ec +om', 'displayName' => 'Bh, M', 'lastName' => 'Bht', 'streetAddress' => '7 Lo Ri Rd', 'email' => 'R.Kal@syf.com', }, 'type' => { 'id' => 'obcdefghijklmn5' }, 'credentials' => { 'provider' => { 'type' => 'AD', 'name' => 'AD.ABC.COM' } }, 'statusChanged' => '2020-04-29T17:58:49.000Z', 'status' => 'ACTIVE', 'activated' => '2020-04-29T17:58:49.000Z', 'created' => '2020-04-29T17:58:47.000Z', '_links' => { 'self' => { 'href' => 'https://ssoqa.abc.com +/api/v1/users/00abcdefghijkl6' } }, 'passwordChanged' => ${\$VAR1->[0]{'passwordChanged'}}, 'lastUpdated' => '2020-11-06T19:09:10.000Z' }, ]
for my $i (0..$#responsetextall) { $responsetextall[$i] =~ s/]\[/,/g; for my $j (0..$#{$responsetextall[$i]}) { my $responseid = $responsetextall[$i][$j]{id}; my $responsests = $responsetextall[$i][$j]{status}; if ($responsests ne "Deactivated") { + run_api_call($apiurluser. $responseid . $apiurl2); my @responsetext4 = parse_json ($client->responseContent()); my $responsecode1 = $client->responseCode() ; for my $m (0..$#responsetext4) { for my $n (0..$#{$responsetext4[$m]}) { + $response1 = $responsetext4[$m][$n]{id}; $resplable = $responsetext4 [$m][$n]{l +abel}; push @mouapps, $resplable; } } my $newurl = ($apiurluser . $responseid ); + run_api_call($newurl); + my @responsetext1 = parse_json ($c +lient->responseContent()); print Dumper @responsetext1 ; for my $l (0..$#responsetext1) { my $response2 = $responsetext1[$l]{id}; my $response3 = $responsetext1[$l]{profile}{firstName}; my $response4 = $responsetext1[$l]{profile}{lastName}; my $response5 = $responsetext1[$l]{profile}{email}; my $response6 = $responsetext1[$l]{credentials}{provide +r}{name}; ## Wrting to the reporting file. $worksheet->write(0, 0, 'OKTA-ID'); $worksheet->write(0, 1, 'FIRST NAME'); $worksheet->write(0, 2, 'LAST NAME'); $worksheet->write(0, 3, 'EMAIL-ID'); $worksheet->write(0, 4, 'Profile-Master'); $worksheet->write(0, 5, 'APPS'); $worksheet->write($r, 0, $response2); $worksheet->write($r, 1, $response3); $worksheet->write($r, 2, $response4); $worksheet->write($r, 3, $response5); $worksheet->write($r, 4, $response6); foreach (@mouapps) { local $" = '|'; my $response7 = join ("|","@mouapps"); $worksheet->write($r, 5, $response7); } $r += 1; } } else { print "Do Nothing" ; } } } $workbook->close; print "Spreadsheet saved.\n";

2020-11-09 Athanasius added code tags around JSON data.


In reply to Re^6: Not an ARRAY reference by chandantul
in thread Not an ARRAY reference by chandantul

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2024-03-29 08:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found