Computer Engineering and Applications ›› 2007, Vol. 43 ›› Issue (15): 98-100.
• 产品、研发、测试 • Previous Articles Next Articles
ZHANG Tao1,2,HUANG Qiang3,MAO Lei-ya1,GAO Xing1
Received:
Revised:
Online:
Published:
Contact:
张 涛1,2,黄 强3,毛磊雅1,高 兴1
通讯作者:
Abstract: Nowadays,XML is mainly applied to data-interchange in current Web application system which is based on Ajax (Asynchronous JavaScript and XML) technology,but as a structured document,XML must be manually resolved between the server-side and the client-side,so that more system resources is consumed,and therefore problems such as weak performance,deficiency of compatibility and lack of sensitivity are caused by using XML. JSON(JavaScript Object Notation) is a lightweight data-interchange format,and it can be easily parsed by browser which supports JavaScript.In this paper,an algorithm of object serialization based on JSON is proposed,by which the JSON grammar is analyzed and the object navigation graph is also established.With this algorithm,the Java objects can be translated into JSON expressions transparently,so as to the client-side can take full advantage of JavaScript engine to parse JSON expressions,thus the problems resulted from XML can be solved effectively.
Key words: Ajax, data-interchange, Java Script Object Notation(JSON), serialization, object navigation graph
摘要: 目前基于Ajax技术的Web开发主要采用XML进行数据交换,然而XML是一种结构化的文档,需要服务器和客户端都对其进行手工解析,将会占用更多的系统资源,因此采用XML进行数据交换会导致性能低下、兼容性不够、灵敏度低的问题。JSON(JavaScript Object Notation)是一种轻量级的数据交换格式,易于被支持JavaScript的浏览器所解析。提出了一种基于JSON的对象序列化算法,该算法通过分析JSON文法并建立对象导航图,透明地将Java对象序列化成JSON表达式,使客户端能够很好地利用JavaScript引擎来解析JSON响应,有效地解决了解析XML所造成的缺陷。
关键词: Ajax, 数据交换, JSON, 序列化, 对象导航图
ZHANG Tao1,2,HUANG Qiang3,MAO Lei-ya1,GAO Xing1. Algorithm of object serialization based on JSON[J]. Computer Engineering and Applications, 2007, 43(15): 98-100.
张 涛1,2,黄 强3,毛磊雅1,高 兴1. 一个基于JSON的对象序列化算法[J]. 计算机工程与应用, 2007, 43(15): 98-100.
0 / Recommend
Add to citation manager EndNote|Ris|BibTeX
URL: http://cea.ceaj.org/EN/
http://cea.ceaj.org/EN/Y2007/V43/I15/98