Skip to content
Advertisement

Nested Arrays and returning non-labeled values

I’ve got an API that returns the following:

JavaScript

I’m able to get the second metric using the following three lines of code:

JavaScript

&value would equal 28.24.

Is there a way to combine these into one line of code? I’m looking for something like this: &value=jsonObj.data.values[0].[1] The issue is the [1] doesn’t have a label

Advertisement

Answer

Your code is almost correct. Just a small correction. Remove the . between [0] and [1]. You don’t need to use . to specify the index. You only need to use it to specify the property/key.

The code should be like

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement