#Use JSON with JS
6 messages · Page 1 of 1 (latest)
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!
✅Marked as resolved by OP
Or is there any other way ?
data.guild.users[0].username but other than that what are you getting the json from? And do you only want that one user‘s username from it or more information?
I just want to know in general, how do we search.
For example in this case my data.json is :
{
"guild": {
"users": [
{
"id": "1097343216078032967",
"username": "His Name"
},
{
"id": "415588601120686091",
"username": "Your Name"
}
]
}
}
And if wanna search a user by his id, how should I process, is it possible or not ?
Documentation suggestion for @crisp walrus:
Array.prototype.find()
The find() method of Array instances returns the first element in the provided array that satisfies the provided testing function. If no values satisfy the testing function, undefined is returned.