i need some help on parsing some json msg, am doing a get request and getting the json output, but need help in parsing it and separating both teams with thier scores in declosed "competitors": {}, {}

this is my json output

{ "leagues": [ { "id": "700", "season": { "year": 2025, "type": { "id": "1", "type": 13481 } }, "logos": [ { "width": 500, "height": 500, "rel": [ "full", "default" ], "lastUpdated": "2019-05-08T16:07Z" }, { "width": 500, "height": 500, "rel": [ "full", "dark" ], "lastUpdated": "2021-08-10T20:43Z" } ], "calendarType": "day", "calendar": [ "2025-08-15T07:00Z" ] } ], "events": [ { "id": "740633", "season": { "year": 2025, "type": 13481 }, "competitions": [ { "id": "740633", "status": { "clock": 540, "displayClock": "9'", "period": 1, "type": { "id": "25", "shortDetail": "9'" } }, "venue": { "id": "197", "fullName": "Turf Moor", "address": { "country": "England" } }, "format": { "regulation": { "periods": 2 } }, "notes": [], "geoBroadcasts": [], "broadcasts": [], "broadcast": "", "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" } ] }, { "id": "364", "homeAway": "away", "score": "0", "records": [ { "name": "All Splits" } ], "team": { "id": "364", "name": "Liverpool", "links": [ { "rel": [ "clubhouse" ], "isHidden": false }, { "rel": [ "stats" ], "isHidden": false }, { "rel": [ "schedule" ], "isHidden": false }, { "rel": [ "squad" ], "isHidden": false } ], "venue": { "id": "192" } }, "statistics": [ { "name": "appearances" } ] } ], "details": [], "odds": [ { "provider": { "id": "2000" }, "awayTeamOdds": { "summary": "1/3", "team": { "id": "364" }, "link": { "language": "en-GB", "rel": [ "away" ], "isHidden": false } }, "homeTeamOdds": { "summary": "8/1", "team": { "id": "379" }, "link": { "language": "en-GB", "rel": [ "home" ], "isHidden": false } }, "drawOdds": { "summary": "4/1", "link": { "language": "en-GB", "rel": [ "draw" ], "isHidden": false } } } ], "wasSuspended": false, "playByPlayAvailable": true, "playByPlayAthletes": true } ], "status": { "clock": 540, "displayClock": "9'", "period": 1, "type": { "id": "25", "shortDetail": "9'" } }, "venue": { "displayName": "Turf Moor" }, "links": [ { "language": "en-GB", "rel": [ "live" ], "isHidden": false }, { "language": "en-GB", "rel": [ "stats" ], "isHidden": false } ] } ] }

this is my part of script i want to fix, and output all teams with the scores

for my $match (@{$parse_json->{leagues}}) { my $elapsed = $match->{competitions}{status}{displayClock}; my $status = $match->{wasSuspended}; my $home = $match->{competitors}{team}{homeAway}; my $away = $match->{competitors}{team}{homeAway}; my $away_goal = $match->{competitors}{score}; my $home_goal = $match->{competitors}{score}; print "$elapsed: $home: $home_goal: Suspended Match: $status"; print "$elapsed: $away: $away_goal: Suspended Match: $status"; }

In reply to 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.