#!perl use strict; use warnings; use JSON::XS (); use Data::Dump 'pp'; # pretty print my $perl = JSON::XS::decode_json get_json(); #pp $perl->{'issues'}[0]; dump structure my $f = $perl->{'issues'}[0]{'fields'}; my $k = $perl->{'issues'}[0]{'key'}; #customfield_22181 as 'Jira Testing' print $f->{'customfield_22181'}."\n"; #customfield_11150{'value'} as 'Yes' print $f->{'customfield_11150'}{'value'}."\n"; #status-{'name'} as 'ProdStaged' print $f->{'status'}{'name'}."\n"; #customfield_11780{'value'} as "'Sunday', 'Monday',...,'Saturday'" print join ",",map{ $_->{'value'}} @{$f->{'customfield_11780'}}; print "\n"; #key as 'TEST-10756' print $k."\n"; sub get_json { return '{"expand":"names,schema","startAt":0,"maxResults":50,"total" +:1,"issues":[{"expand":"operations,versionedRepresentations,editmeta, +changelog,transitions,renderedFields","id":"569825","self":"https://e +xample.com/rest/api/2/issue/569825","key":"TEST-10756","fields":{"sum +mary":" Automated Testing","issuetype":{"self":"https://example.com/r +est/api/2/issuetype/10100","id":"10100","description":"","iconUrl":"h +ttps://example.com/secure/viewavatar?size=xsmall&avatarId=26414&avata +rType=issuetype","name":"Auto Testing","subtask":false,"avatarId":264 +14},"customfield_11150":{"self":"https://example.com/rest/api/2/custo +mFieldOption/11347","value":"Yes","id":"11347"},"customfield_11780":[ +{"self":"https://example.com/rest/api/2/customFieldOption/12841","val +ue":"Sunday","id":"12841"},{"self":"https://example.com/rest/api/2/cu +stomFieldOption/12842","value":"Monday","id":"12842"},{"self":"https: +//example.com/rest/api/2/customFieldOption/12843","value":"Tuesday"," +id":"12843"},{"self":"https://example.com/rest/api/2/customFieldOptio +n/12844","value":"Wednesday","id":"12844"},{"self":"https://example.c +om/rest/api/2/customFieldOption/12845","value":"Thursday","id":"12845 +"},{"self":"https://example.com/rest/api/2/customFieldOption/12846"," +value":"Friday","id":"12846"},{"self":"https://example.com/rest/api/2 +/customFieldOption/12847","value":"Saturday","id":"12847"}],"customfi +eld_22380":"2016-02-20","customfield_22181":"Jira TEST-10756 Automate +d Testing","customfield_11179":"2015-12-11","updated":"2016-01-06T14: +15:14.000-0500","status":{"self":"https://example.com/rest/api/2/stat +us/10034","description":"","iconUrl":"https://example.com/images/icon +s/statuses/generic.png","name":"ProdStaged","id":"10034","statusCateg +ory":{"self":"https://example.com/rest/api/2/statuscategory/4","id":4 +,"key":"indeterminate","colorName":"yellow","name":"In Progress"}}}}] +}'; };
poj

In reply to Re^3: Getting specific field values from JIRA rest/api output using JSON::XS and array of hashes by poj
in thread Getting specific field values from JIRA rest/api output using JSON::XS and array of hashes by Anonymous Monk

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.