L
L
LdXDelaxy2020-09-01 10:20:30
Arrays
LdXDelaxy, 2020-09-01 10:20:30

How to read this array?

In general, I have an array that I can’t read in any way

[{"534565478423434":{coins:100},"364763211246686":{coins:77},"4354243024667":{coins:26}}]

Everything is simple here, id is taken and after coins, so because of [] I simply cannot read this array.
Here's what comes up hope you can help me [object Object] undefined

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2020-09-01
@Alexandre888

such a structure is called an 'array of objects'.
an array element can be obtained by its index [], an object element - by the name of the key [key].
in your case, the index of the object in the array is 0, we get it like this: further, we just work with the object itself -
arr[0]
arr[0][key].property

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question