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

          JSON簡介

          Posted on 2007-09-20 21:55 semovy 閱讀(405) 評論(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) 是一種輕量級的數據交換格式。易于人閱讀和編寫。同時也易于機器解析和生成。它基于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的數值非常相似。除去未曾使用的八進制與十六進制格式。除去一些編碼細節。

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






          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

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


          網站導航:
          相關文章:
           
          主站蜘蛛池模板: 改则县| 枣阳市| 衡阳市| 阳朔县| 孝昌县| 广汉市| 新乡县| 沂水县| 铜梁县| 商城县| 怀仁县| 曲松县| 普宁市| 宁波市| 桓仁| 桂平市| 鹿邑县| 玉屏| 平武县| 东宁县| 紫阳县| 高邮市| 宜昌市| 城固县| 延边| 永吉县| 通化县| 社旗县| 新化县| 盐源县| 连南| 措美县| 康乐县| 比如县| 乐山市| 龙海市| 翼城县| 山丹县| 安顺市| 依兰县| 桃园市|