Is it possible to search within a JSON API response?

Hello forum,

I have a question about searching within a API response.

This is the JSON response:

  •                 {
                      "name": "Servicekosten",
                      "value": "€ 99 per maand"
                  },
                  {
                      "name": "Aangeboden sinds",
                      "value": ""
                  },
                  {
                      "name": "Status",
                      "value": "Beschikbaar"
                  },
                  {
                      "name": "Aanvaarding",
                      "value": "Beschikbaar per 1-5-2024"
                  }
              ]
    

I want to search for the “Status” value in this example is “Beschikbaar”, how can I search this value in this screenshot below?

Schermafbeelding 2024-03-13 om 16.25.36

You need to filter the relevant list of objects by the ‘name’ field… where name = Status… then extract that item’s value.

Thanks, I tried this now but with no succes;

Well… assuming you’re filtering the correct array (I can’t see from your screenshot what you’re doing), then what do you mean by ‘with no success’?

Is it returning the wrong item? no item? what?

What does the Debugger show?

My guess is you’re filtering the wrong thing.

1 Like

It’s hard to know if you set the filter correctly because we don’t have the full JSON. But normally, after filtered:first item… this should be 's value … this is not what we see in your screenshot. So pretty sure you are not filtering the data at the correct level in JSON

2 Likes

Ah thanks, I need filtered at the wrong level I figured it out now. Thanks :slight_smile:

3 Likes

This topic was automatically closed after 70 days. New replies are no longer allowed.