Possible Duplicate:
How to parse JSON using NodeJS?可能重复:如何使用NodeJS解析JSON ?
I am running a server. The code is run on the server with Node.js -- never run in a browser.
我正在运行一个服务器。代码在带有节点的服务器上运行。js——永远不要在浏览器中运行。
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.
如何将JSON文件(“data.json”)加载到javascript代码中作为javascript对象?我是否应该使用jQuery/AJAX来实现这一点?用普通js有什么简单的方法吗?提前谢谢!顺便说一句,我在谷歌和这个网站上搜索了这个,没有任何明确的答案。