I need to search for a specific term in a JSON array and get the index of the array element which contains the term as its value of a key, below is a sample JSON file that I'm working on, I need to get the array element whose "artifact\_id" is "jar", so in this case I need to get the index of the array which is `1`, the "artifact\_id" is guaranteed to be unique:

```
{
    "maven": [
      {
        "version": "1.2",
        "artifact_id": "zip"
      },
      {
        "version": "1.2",
        "artifact_id": "jar"
      }
    ]
}

```

I'm using the JSON lib and can decode the JSON to a Perl object, anyone can suggest the next step for me? Thanks a lot. 

```
my $json_text = do {
               open( my $json_fh, "<:encoding(UTF-8)", $filename[0] )
               or die("Can't open \$filename\": $!\n");
               local $/;
               <$json_fh>;
};
my $json = JSON->new;
my $json_data = $json->decode($json_text);

```