I have this JSON array:
{
"data": [
{
"id": 6,
"pnome": "dasda",
"unome": "dad",
"avatar": 1,
"email": "d",
"pass": "password",
"ponto": 0
},
{
"id": 3,
"pnome": "Enguias",
"unome": "Enguias outra vez",
"avatar": 10,
"email": "enguias@enguias.enguias",
"pass": "enguias",
"ponto": 0
},
{
"id": 2,
"pnome": "André",
"unome": "Marques",
"avatar": 1,
"email": "aglmarque@gmail.com",
"pass": "yet1",
"ponto": 0
}
]
}
And i'm putting it into an array with axios, like this:
axios.get(my_url_api)
.then((res)=>{
const txt = JSON.stringify(res.data.data);
const users = JSON.parse(txt)
})
Which makes the users array have all the info in the JSON file. How can I make it so that I only pass specific attributes like email and pass? It would look like this:
{
"data": [
{
"email": "d",
"pass": "password"
},
{
"email": "enguias@enguias.enguias",
"pass": "enguias"
},
{
"email": "aglmarque@gmail.com",
"pass": "yet1"
}
]
}