=代 码 下 载 > Javascript/HTML > 最新Json.js文件下载=
| 最新Json.js文件下载 |
| 演示示例 | 无演示示例 |
| 所属Tag | Javascript/HTML |
| 文件类型那个 |  |
| 运行环境 | 浏览器 |
| 推荐指数 | |
| 软件大小 | 8.52KB |
| 整理时间 | 2011-4-20 11:38:51 |
| 下载文件 |  |
| 软件介绍 | 最新Json.js文件下载,json.js将JavaScript对象转换成字符串或者将json格式的字符创转换为json对象。
使用说明 json.js 2007-08-05
Public Domain
This file adds these methods to JavaScript:
array.toJSONString() boolean.toJSONString() date.toJSONString() number.toJSONString() object.toJSONString() string.toJSONString() These methods produce a JSON text from a JavaScript value. It must not contain any cyclical references. Illegal values will be excluded.
The default conversion for dates is to an ISO string. You can add a toJSONString method to any date object to get a different representation.
string.parseJSON(filter) This method parses a JSON text to produce an object or array. It can throw a SyntaxError exception.
The optional filter parameter is a function which can filter and transform the results. It receives each of the keys and values, and its return value is used instead of the original value. If it returns what it received, then structure is not modified. If it returns undefined then the member is deleted.
Example:
// Parse the text. If a key contains the string 'date' then // convert the value to a date.
myData = text.parseJSON(function (key, value) { return key.indexOf('date') >= 0 ? new Date(value) : value; });
It is expected that these methods will formally become part of the JavaScript Programming Language in the Fourth Edition of the ECMAScript standard in 2008.
This file will break programs with improper for..in loops. See http://yuiblog.com/blog/2006/09/26/for-in-intrigue/
This is a reference implementation. You are free to copy, modify, or redistribute.
Use your own copy. It is extremely unwise to load untrusted third party code into your pages. */
/*jslint evil: true */
// Augment the basic prototypes if they have not already been augmented. |