Node(23) JSON
来源:互联网 发布:淘宝开网店的必备条件 编辑:程序博客网 时间:2024/06/07 10:23
JSON example profiles.js
module.exports = {Peter : {name: 'Peter Parker',age: '18',gender: 'M',grade: 'B'},Alex : {name: 'Alex Giggersn',age: '23',gender: 'F',grade: 'B+'}}
JSON functions
JSON.parse(text [, reviver])
JSON.stringify(JSONvalue [, replacer] [, space])
var profiles = require( './profiles');//convert json to string, replace 'name' with 'fullname'profiles = JSON.stringify(profiles).replace( /name/g, 'fullname' );//parse string back to jsonprofiles = JSON.parse( profiles );//fix Alex's fullnameprofiles.Alex.fullname = "Alex Giggerson";//log Alex infoconsole.log( profiles.Alex );
Posting Json Object
Like other types, when you want to send object by POST method, you have to specify the header's mime type
xmlhttp.setRequestHeader("Content-Type","application/json");
xmlhttp.setRequestHeader("Content-Length",jsonString.length);
- Node(23) JSON
- Node.js JSON模块
- Node.js 处理JSON
- Node读写JSON
- Node.js3 package.json文件
- Node.js判断 json格式
- json+underscore+Node 小例子
- node.js protocol buffer与json
- node.js xml与json相互转化
- node.js导出json,csv格式
- 格式化JSON的NODE.JS代码片段
- node.js获取RSS返回json
- node.js 加载包 package.json
- node.js项目中的package.json
- node.js xml与json相互转化
- node-webkit 项目中的 package.json
- Node入门--10-->HTML&JSON
- Node.js 之package.json文件
- TC SRM551 DIV2 500 ColorfulChocolates 暴力
- Android ApiDemos示例解析(106):Views->Chronometer
- 项目的深入理解需要自顶向下与自底向上的学习
- H264基本概念之 色彩空间(RGB vs YUV)
- PHP mysql apache开发环境配置 php
- Node(23) JSON
- notes for the computer networks architechture
- 定位临界区(critical section)导致的死锁
- 谈谈嵌入式中的GCC
- Vaadin Web应用开发教程(8):UI组件-Label
- 开源IP核
- 更新Ubuntu软件源
- 静态成员函数
- Android 4.0 Launcher2源码分析——Launcher内容加载详细过程