K
K
Kropovniczky2021-01-02 16:30:40
JSON
Kropovniczky, 2021-01-02 16:30:40

How to check against all objects in JSON base?

For example I have

{
   “players”: {
        “1”: {
            “money”: 0
         }
         “2”:{
             “money”:10
         }
}
}


And when I need to find all the players with money 0 (to display 2) and (for example the name of the players file) I enter players.players.money(0). But of course, it gives me an error, because after the second players the argument [] is needed. Suppose if I already knew a specific player with money 0, then I would enter players.players[2].money. But unfortunately I need to find all players with money 0 whose numbers I don't know.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dr. Bacon, 2021-01-02
@bacon

I - iteration

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question