What would be a syntactically optimal way to obtain a JS object from JSON? I have a json file describing form fields, from it I would like to obtain JS object that contains only the value of the name field, equal to null. Like so:
JSON Input :
[
{
"name": "firstname",
"en": "First Name",
"fr": "Prénom",
"type": "text"
},
{
"name": "name",
"en": "Last Name",
"fr": "Nom",
"type": "text"
},
{
"name": "email",
"en": "Email",
"fr": "Email",
"type": "text"
},
{
"name": "password",
"en": "Password",
"fr": "Mot de Passe",
"type": "password"
}
]
Js object result:
{
firstname: null,
name: null,
email: null,
password: null
}
Any suggestions?