posts - 0, comments - 77, trackbacks - 0, articles - 356
            BlogJava :: 首頁 :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理

          JSON簡介

          Posted on 2007-09-20 21:55 semovy 閱讀(406) 評論(0)  編輯  收藏 所屬分類: JSON

          介紹 JSON



          object
          {}
          { members }
          members
          pair
          pair , members
          pair
          string : value
          array
          []
          [ elements ]
          elements
          value
          value , elements
          value
          string
          number
          object
          array
          true
          false
          null

          string
          ""
          " chars "
          chars
          char
          char chars
          char
          any-Unicode-character-
              except-"-or-\-or-
              control-character
          \"
          \\
          \/
          \b
          \f
          \n
          \r
          \t
          \u four-hex-digits
          number
          int
          int frac
          int exp
          int frac exp
          int
          digit
          digit1-9 digits
          - digit
          - digit1-9 digits
          frac
          . digits
          exp
          e digits
          digits
          digit
          digit digits
          e
          e
          e+
          e-
          E
          E+
          E-

          JSON(JavaScript Object Notation) 是一種輕量級的數(shù)據(jù)交換格式。易于人閱讀和編寫。同時也易于機器解析和生成。它基于JavaScript Programming Language, Standard ECMA-262 3rd Edition - December 1999的一個子集。 JSON采用完全獨立于語言的文本格式,但是也使用了類似于C語言家族的習(xí)慣(包括C, C++, C#, Java, JavaScript, Perl, Python等)。這些特性使JSON成為理想的數(shù)據(jù)交換語言。

          JSON建構(gòu)于兩種結(jié)構(gòu):

          • “名稱/值”對的集合(A collection of name/value pairs)。不同的語言中,它被理解為對象(object),紀錄(record),結(jié)構(gòu)(struct),字典(dictionary),哈希表(hash table),有鍵列表(keyed list),或者關(guān)聯(lián)數(shù)組 (associative array)。
          • 值的有序列表(An ordered list of values)。在大部分語言中,它被理解為數(shù)組(array)。

          這些都是常見的數(shù)據(jù)結(jié)構(gòu)。事實上大部分現(xiàn)代計算機語言都以某種形式支持它們。這使得一種數(shù)據(jù)格式在同樣基于這些結(jié)構(gòu)的編程語言之間交換成為可能。

          JSON具有以下這些形式:

          對象是一個無序的“‘名稱/值’對”集合。一個對象以“{”(左括號)開始,“}”(右括號)結(jié)束。每個“名稱”后跟一個“:”(冒號);“‘名稱/值’ 對”之間使用“,”(逗號)分隔。

          數(shù)組是值(value)的有序集合。一個數(shù)組以“[”(左中括號)開始,“]”(右中括號)結(jié)束。值之間使用“,”(逗號)分隔。

          值(value)可以是雙引號括起來的字符串(string)、數(shù)值(number)、truefalsenull、對象(object)或者數(shù)組(array)。這些結(jié)構(gòu)可以嵌套。

          字符串(string)是由雙引號包圍的任意數(shù)量Unicode字符的集合,使用反斜線轉(zhuǎn)義。一個字符(character)即一個單獨的字符串(character string)。

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

          數(shù)值(number)也與C或者Java的數(shù)值非常相似。除去未曾使用的八進制與十六進制格式。除去一些編碼細節(jié)。

          空白可以加入到任何符號之間。 以下描述了完整的語言。






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

          json@JSON.org

          只有注冊用戶登錄后才能發(fā)表評論。


          網(wǎng)站導(dǎo)航:
          相關(guān)文章:
           
          主站蜘蛛池模板: 云南省| 江孜县| 抚宁县| 阿拉善右旗| 和平县| 贡嘎县| 玉门市| 康乐县| 墨玉县| 桃园市| 宣汉县| 越西县| 高州市| 巨野县| 虹口区| 特克斯县| 彭阳县| 湖口县| 公主岭市| 桓仁| 阿巴嘎旗| 江安县| 咸阳市| 沾化县| 波密县| 朝阳市| 铅山县| 临湘市| 洛浦县| 黄大仙区| 长治县| 阿荣旗| 高邮市| 滨海县| 宝清县| 黑龙江省| 屏东县| 玉溪市| 高邮市| 策勒县| 柘城县|