Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在寻找如何使用 node.js 来解码 json。
我的应用程序非常简单。我会收到一个 Request: PUT with json。如果存在发送成功(200)响应,我需要检查 json 正文中的某个值。
如何在节点中执行有效的 json。
,
var code = 'something you need to check'; try { var decoded = JSON.parse(code); // valid json } catch(e) { // invalid json }