thanks i have got it working now, my reaming problem is only 1 to separate home and away team scores (results)

teams results are in "competitors":[{}]

"competitors":[ { "id":"379", "homeAway":"home", "score":"0", "records":[ { "name":"All Splits" } ], "team":{ "id":"379", "name":"Burnley", "links":[ { "rel":[ "clubhouse" ], "isHidden":false }, { "rel":[ "stats" ], "isHidden":false }, { "rel":[ "schedule" ], "isHidden":false }, { "rel":[ "squad" ], "isHidden":false } ], "venue":{ "id":"197" } }, "statistics":[ { "name":"appearances" } ] }, # Here is next curly braces for away team { "id":"364", "homeAway":"away", "score":"3", "records":[ { "name":"All Splits" } ], "team":{ "id":"364", "name":"Manchester City", "links":[ { "rel":[ "clubhouse" ], "isHidden":false }, { "rel":[ "stats" ], "isHidden":false }, { "rel":[ "schedule" ], "isHidden":false }, { "rel":[ "squad" ], "isHidden":false } ], "venue":{ "id":"192" } }, "statistics":[ { "name":"appearances" } ] } ],

Now i need some magic to separate curly braces for each team results and output this

90'+7': Burnley scored 0 status: 0 90'+7': Manchester City scored 3 status: 0

This is my working code

for my $match (@{$parse_json->{'events'}}) { my $elapsed = $match->{competitions}[0]{status}{displayClock}; my $status = $match->{competitions}[0]{wasSuspended}; # 0 false +/ 1 true | "wasSuspended":false, my $home = $match->{competitions}[0]{competitors}[0]{'team'}{n +ame}; my $away = $match->{competitions}[0]{competitors}[0]{'team'}{n +ame}; my $home_score = $match->{competitions}[0]{competitors}[0]{score}; my $away_score = $match->{competitions}[0]{competitors}[0]{score}; print "$elapsed: $home scored $home_score status: $status"; }

In reply to Re^2: parse json by frank1
in thread parse json by frank1

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.