json data optimization for better extraction

0

I need guidance as to how to structure some data for a better extraction and utilization of these.

The data I have has a structure similar to this:

Clima->
region->provincia->ciudad->Farmnacias->
Bencinas->
informacion_adicional->
varios_datos_mas    

and what I did was create each node separately identifying each node with a ID of the region, province and city leaving something like this:

 region
 provincia->idregion
 ciudad->idregion, idprovincia
 Clima->idciudad, idregion,idprovincia
 Farmnacias->idciudad, idregion,idprovincia
 Bencinas->idciudad, idregion,idprovincia

All these are inserted from php to firebase database and then to an app in angualrJs2 and ionic2 , I would appreciate any help.

    
asked by Dagg 12.07.2017 в 07:00
source

1 answer

1

The json below can be a guide, it is probably not optimal because I do not have all the information about your project, but it is a good starting point.

{
  "regiones": [
    {
      "id": 1,
      "nombre": "Región 1",
      "provincias": [
        {
          "id": 1,
          "nombre": "Provincia 1",
          "ciudades": [
            {
              "id": 1,
              "nombre": "Ciudad 1",
              "clima": "20°",
              "farmacias": [],
              "bencinas": []
            }
          ]
        },
        {
          "id": 2,
          "nombre": "Provincia 2",
          "ciudades": []
        }
      ]
    },
    {
      "id": 2,
      "nombre": "Región 2",
      "provincias": []
    }
  ]
}
    
answered by 12.07.2017 в 07:43