samedi 17 mars 2018

Retrive Json Data, reformat it and create new endpoint

What is the best way to get some Json data from a public api such as British Air quality i.e and create a new endpoint with some of the data under a different name like

{ 
  "data":[{ 
    "from": "2018-03-17T22:00Z",
    "to": "2018-03-17T22:30Z",
    "intensity": {
      "forecast": 251,
      "actual": 250,
      "index": "moderate"
    }
  }]
}

To this (I'm dropping some information I don't need)

{
"Weather": [
   {"newName": "forecastValue"},
   {"newName2": "ActualValue"}
 ]
}

I am facing this problem because I'm working with a third party application which only supports Json if it is formatted like that (2 Values and special name)...

Thank you very much in advance for any help!




Aucun commentaire:

Enregistrer un commentaire