I came up with this to extract the ID tag its a horrible hack. Anyone know how I can extract the correct data everytime.?

Not sure, the format seems too dumb to correctly get the thing you want each time, both "Qualifiers" and "World Cup 2014" are of type "COMPETITION"

Your jsontidy.pl data

{ "in-running-flag" : false, "markets" : [], "status" : "paid", "name" : "Georgia vs Finland", "allow-live-betting" : false, "meta-tags" : [ { "name" : "Soccer", "type" : "SPORT", "id" : 4 }, { "name" : "Qualifiers", "type" : "COMPETITION", "id" : 650 }, { "name" : "World Cup 2014", "type" : "COMPETITION", "id" : 5 }, { "name" : "Sport", "type" : "Root", "id" : 1 }, { "name" : "September 10th 2013", "type" : "DATE", "id" : 651 } ], "category-id" : [ 146598 ], "sport-id" : 15, "id" : 241995, "start" : "2013-09-10T17:00:00.000Z" }

So what I would do is

my @meata = ...; my %cat; for my $meat ( @meata ){ my( $type, $id, $name ) = @{$meat}{qw/ type id name/}; $cat{ $type }{ $id } = $name; }
Then %category of $type of $id is $nameed

Then %category of $type of $id is valued $name

Then %category of $type of $id has value $name


In reply to Re: JSON ARRAY Problem (category of type of id is named) by Anonymous Monk
in thread JSON ARRAY Problem by Gruaig

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.