JSON -- 轻量级的数据交换语言

来源:互联网 发布:中国和美国的差距知乎 编辑:程序博客网 时间:2024/05/02 02:37

JSON(JavaScript Object Notation) 是一种轻量级的数据交换格式。易于人阅读和编写。同时也易于机器解析和生成。它基于JavaScript Programming Language, Standard ECMA-262 3rd Edition - December 1999的一个子集。 JSON采用完全独立于语言的文本格式,但是也使用了类似于C语言家族的习惯(包括C, C++, C#, Java, JavaScript, Perl, Python等)。这些特性使JSON成为理想的数据交换语言。

JSON建构于两种结构:

  • “名称/值”对的集合(A collection of name/value pairs)。不同的语言中,它被理解为对象(object),纪录(record),结构(struct),字典(dictionary),哈希表(hash table),有键列表(keyed list),或者关联数组 (associative array)。
  • 值的有序列表(An ordered list of values)。在大部分语言中,它被理解为数组(array)。

这些都是常见的数据结构。事实上大部分现代计算机语言都以某种形式支持它们。这使得一种数据格式在同样基于这些结构的编程语言之间交换成为可能。

JSON具有以下这些形式:

对象是一个无序的“‘名称/值’对”集合。一个对象以“{”(左括号)开始,“}”(右括号)结束。每个“名称”后跟一个“:”(冒号);“‘名称/值’ 对”之间使用“,”(逗号)分隔。

数组是值(value)的有序集合。一个数组以“[”(左中括号)开始,“]”(右中括号)结束。值之间使用“,”(逗号)分隔。

值(value)可以是双引号括起来的字符串(string)、数值(number)、truefalsenull、对象(object)或者数组(array)。这些结构可以嵌套。

 

字符串(string)是由双引号包围的任意数量Unicode字符的集合,使用反斜线转义。一个字符(character)即一个单独的字符串(character string)。

字符串(string)与C或者Java的字符串非常相似。

数值(number)也与C或者Java的数值非常相似。除去未曾使用的八进制与十六进制格式。除去一些编码细节。

空白可以加入到任何符号之间。 以下描述了完整的语言。


  • ASP:
    • JSON for ASP.
    • JSON ASP utility class.
  • ActionScript:
    • ActionScript1.
    • ActionScript2.
    • ActionScript3.
    • JSONConnector.
  • C.
    • JSON_checker.
    • JSON parser.
    • json-c.
    • M's JSON parser.
    • YAJL.
  • C++:
    • TinyJSON.
    • jsoncpp.
    • zoolib.
    • Jaula.
    • JOST.
    • JSON Spirit.
    • CAJUN.
  • C#:
    • JSON_checker.
    • Jayrock.
    • Json.NET - LINQ to JSON.
    • JSONSharp.
    • LitJSON.
    • JSON for .NET.
    • JsonFx.
    • JsonExSerializer.
    • How do I write my own parser?
  • ColdFusion:
    • ColdFusion 8.
    • CFJSON.
    • toJSON.
  • D.
  • Delphi:
    • Delphi Web Utils.
    • JSON Delphi Library.
    • JSON Toolkit.
  • E.
  • Eiffel.
  • Erlang.
  • Fan.
  • Flex.
  • Haskell:
    • RJson package.
    • json package.
    • JSON.hs.
    • HaskellNet.
  • haXe.
  • Java:
    • org.json.
    • org.json.me.
    • Json-lib.
    • JSON Tools.
    • json-simple.
    • Stringtree.
    • SOJO.
    • VRaptor.
    • Restlet.
    • Jettison.
    • json-taglib.
    • FLEXJSON.
    • XStream.
    • JsonMarshaller.
    • Flexjson.
    • Jackson JSON Processor.
    • JON tools.
    • google-gson.
  • JavaScript:
    • json2.js.
      • Chinese.
    • json_parse.js.
    • json_parser_state.js.
    • json_sans_eval.
  • Lasso.
  • Lisp:
    • Common Lisp
      • Common Lisp JSON.
      • Yason.
    • Emacs Lisp.
    • Chicken Scheme.
    • MZScheme.
    • PLT Scheme.
  • LotusScript:
    • JSON LS.
    • JSON Reader/Writer.
  • Lua:
    • Json4Lua.
    • Json.lua.
  • Objective C:
    • BSJSONAdditions.
    • Cocoa JSON Framework.
  • Objective CAML.
  • OpenLaszlo.
  • Perl.
  • PHP:
    • PHP 5.2.
    • json.
    • Services_JSON.
    • Zend_JSON.
    • JSONRPC.
    • Solar_Json.
    • SCA_SDO.
    • Comparison of php json libraries.
  • Pike:
    • Public.Parser.JSON.
    • Public.Parser.JSON2.
  • pl/sql.
  • PowerShell.
  • Prolog:
    • SWI-Prolog HTTP support
    • json.prolog.
  • Python:
    • The Python Standard Library.
    • simplejson.
    • pyson.
  • R.
  • REALbasic.
  • Rebol.
  • Ruby:
    • json.
    • yajl-ruby.
  • Squeak.
  • Tcl.
  • Visual Basic.
  • Visual FoxPro.

 


  • RFC 4627 application/json.
  • The <module> Tag.
  • JSONRequest.
  • JSONRequest Extension for Firefox.
  • The Fat-free Alternative to XML
  • An example of JSON-encoded messages.
  • The JSON Group on Yahoo!
  • Yahoo! JSON
  • Google Data
  • GeoJSON
  • JSON shell for the browser
  • JSONT.
  • JSON Template.
  • JSONPath.
  • JPath.
  • Jaql: A JSON Query Language.
  • JSPON.
  • JsonML.
  • CSS JSON.
  • JSON 2 HTML.
  • XSLTJSON.
  • xml2json-xslt.
  • x-xml2jsonphp.
  • Parsing JSON into XQuery.
  • Pure.
  • JSON.com.
  • JSON-RPC.
  • JSON-RPC-Page.
  • jabsorb.
  • JSON-Cache.
  • CouchDB.
  • DBSlayer.
  • Persevere.
  • SpringDB.
  • StrokeDB.
  • JSONLint, The JSON Validator.
  • JSLint, Syntax Checker.

 


Why JSON isn't just for JavaScriptI can't believe it's not XML!The JSON vs XML debate begins in earnestJSON and XMLJSON vs. XML as a data interchange formatExamining JSONJSON and .NetShaping the future of secure Ajax mashupsJSON and Browser Security

原创粉丝点击