-3

I starting to use JSON , I got this problem

{
  "Usuarios" : {
    "1_Michelle" : {
      "datos" : {
        "afeccion" : "72",
        "lat" : "-0.2830356023921064",
        "lng" : "-78.55023108422756",
      }
    },
    "2_Javier" : {
      "datos" : {
        "afeccion" : "72",
        "lat" : "-0.2830356023921064",
        "lng" : "-78.55023108422756",
      }
    }
  }
}

I'm trying to save like this

var users=["1_Michelle","2_Javier"];
var lat = [123n,123n];
var lng = [123n,123n];

but The main problem that I got it's I can't access for the second entity that are Michelle and Javier , I was trying for each but it doesn't work idk why. This JSON I'm getting from FireBase Any help would be really appreciated and good rated ty

1 Answers1

1

Imagine that JSON you have in data variable, then you can get these names with this

let names = Object.keys(data.Usuarios)

Then you will have these names in names

Dominik Matis
  • 2,086
  • 10
  • 15