Saturday, 15 April 2017

how can i parse a json file to an array of objects in node js

i have a json file i require this file to my json code and i need to parse it in an array of objects this for exemple the json file

{
  "movies": [
    {
      "title": "Star Wars",
      "year": 1977,
      "director": "George Lucas"
    },
    {
      "title": "The Empire Strikes Back",
      "year": 1980,
      "director": "Irvin Kershner"
    },
    {
      "title": "Return of the Jedi",
      "year": 1983,
      "director": "Richard Marquand"
    }]
} 

and i want to convert it to this array

[{title:"Star Wars", year:1977, director:"George Lucas"},{},{}]



via Hachimi Ahmed Amine

No comments:

Post a Comment