Help decoding GeoLocation JSON results

I have the following results where I am trying to get the iso_code and names[en] in a pipline rule.

because the result of subdivisions is a list or dictionaries, i have tried a few things and cannot get any results.

can anyone tell me what I’m doing wrong? thanks!

geo["subdivisions"][0].iso_code
geo["subdivisions"].0.iso_code
geo["subdivisions"].iso_code
"subdivisions": [
      {
        "confidence": null,
        "geoname_id": 2951839,
        "iso_code": "BY",
        "names": {
          "de": "Bayern",
          "ru": "Бавария",
          "pt-BR": "Baviera",
          "ja": "バイエルン",
          "en": "Bavaria",
          "fr": "Bavière",
          "zh-CN": "巴伐利亚州",
          "es": "Baviera"
        }
      }
    ]

Well, on Github I found that I can try .[0]., ill keep you posted if it works.

.[0]. did Work, I found the post below from version 5.2 that haven’t been updated in over a year but it looks like its not fixed.

I also tried: set_field(“destination_ip_state_abbrev”, to_string(geo[“subdivisions”].[0].iso_code)); per the post and its still failing. Did anyone get that working? Thanks

This was the fix per github, works 50% of the time. Still issues when the list is empty as 0 shows up as invalid index. Works fine when its present.

set_field("destination_ip_state", to_string(geo["subdivisions"].[0].names.en, "", "", "", "no_value"));

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.