in reply to parse out json message

What is the element you need to loop through to get the {team}{name} value? Is it sports? No. It's nested, at {sports}[0]{leagues}[0]{teams}. That's what you need to loop through. It's an arrayref, so you have to treat it like an array in your code.

say $_->{team}{name} for @{ $parse_json->{sports}[0]{leagues}[0]{teams} };

Please try to understand this before you use it in your code.


The way forward always starts with a minimal test.

Replies are listed 'Best First'.
Re^2: parse out json message
by frank1 (Monk) on Sep 15, 2025 at 22:02 UTC

    thank you, its working now, thanks for explanation and demo