2

Possible Duplicate:
How to parse JSON using NodeJS?

I am running a server. The code is run on the server with Node.js -- never run in a browser.

How can I load a JSON file ("data.json") into javascript code as a javascript object? Should I just use jQuery/AJAX to do this? Is there a simple way with plain js? Thanks in advance! BTW I searched for this on both Google and this website without any clear answers.

Community
  • 1
  • 1
Erik Nelson
  • 1,019
  • 3
  • 12
  • 13

1 Answers1

3

Have a look at this

Read the whole contents of the file, and then just parse it.
Have a look at this question.

Community
  • 1
  • 1
Adrian Salazar
  • 5,279
  • 34
  • 51