?? json.md.svn-base
字號:
Object: JSON {#JSON}
====================
JSON的編碼與解析
### 另參考:
- [JavaScript Object Notation (JSON.org)](http://www.json.org/)
JSON 方法: encode {#JSON:encode}
----------------------------------
將object或數組轉換成JSON格式的字符串
### 語法:
var myJSON = JSON.encode(obj);
### 參數:
1. obj - (*object*) object或數組
### 返回值:
* (*string*) JSON字符串
### 示例:
var fruitsJSON = JSON.encode({apple: 'red', lemon: 'yellow'});
// 返回: '{"apple":"red","lemon":"yellow"}'
JSON 方法: decode {#JSON:decode}
----------------------------------
將JSON字符串轉換成JavaScript對象
### 語法:
var object = JSON.decode(string[, secure]);
### 參數:
1. string - (*string*) JSON字符串
2. secure - (*boolean*, 可選: 默認為false) 如果為true, 則必須使用標準JSON語法(如果使用了非標準語法, 則結果將返回null)
### 返回值:
* (*object*) JSON字符串轉換后的JavaScript對象
### 示例:
var myObject = JSON.decode('{"apple":"red","lemon":"yellow"}');
//返回: {apple: 'red', lemon: 'yellow'}
### Credits:
- JSON test regexp is by [Douglas Crockford](http://crockford.com/) and [Tobie Langel](http://tobielangel.com/).
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -