I have a archive.json
file like below:
var archive = {
"archiveList" : [
{ url : "https://ddddd",
greetings : "blahblahblah"},
{ url :"https://ddd1",
greetings : "blahblah"},
.....
]
}
I use the var
keyword because I want to read from static page.
Here is the problem. I want to read that file and update archivelist array. How can I parse this file?
=============================Add more info================================
What I'm trying to is two things.
In static page, Read json(or js object) data from static page and show up
In server with node.js, Read json and insert archiveList data
What I read is this : https://stackoverflow.com/a/18637657/6234242
First thing what I'm trying to is solved, but Second one is my problem.
When I use module.exports = {...}
, First thing is not working.
=============================Add more info================================
When I load and parse archive.json
file, console says below.
undefined:1
var archive = {
^
SyntaxError: Unexpected token v in JSON at position 1
at JSON.parse (<anonymous>)