I have a JSON file which contains the following:
[
{
“name”: “Joshia \”Placement\” Fonz”,
“color”: “white”
},
{
"name": “Trin Brin”,
“color”: “black”
},
{
“name”: “Su Et”,
“color”: “yellow”
}
]
And I would like to parse it to use the array and objects for the application. So './students.json'
being the path for the JSON file, I attempted JSON.parse('./students.json')
but got an error Uncaught SyntaxError: Unexpected token . in JSON at position 0
, and tried JSON.stringify('./students.json')
but it simply returned me the exact string of the path './students.json'
.
So can I parse the JSON file in Javascript to use the array?
Thank you