How do you get the third level value from JSON string with dynamic keys?

Hi,

I have trying to access a value what has a dynamic key. E.g the first key is “.json[“18:39”][“marketVolume”]” and the second is “.json[“18:38”][“marketVolume”]”

I need to be able to access it dynamically as there could be 500 items.

Here is a sample code:

Hi there,

check out this documentation, it should give you an idea of how to do it. :wink:

2 Likes

Hi @wallinex, I think Object.keys() is what you’re looking for here. this would return all properties and you can pick the first one.

Keep in mind that the order of properties isn’t guaranteed in JSON, so it’ll depend on your data source whether this will actually work.

Here’s an example:

Edit: Darn, @BramKn beat me to it once again. Anyway, hope the example is still helpful.

2 Likes

Brilliant thank you @MutedJam & @BramKn ! I’ve been googling for hours to find this documentation :sweat_smile:

1 Like