zoukankan      html  css  js  c++  java
  • 写在WCF实现RESTFul Web Service之前(一):JSON基本概念

    JSON基本概念:
    WIKIPEDIA : JSON (JavaScript Object Notation), is a lightweight text-based open standard designed for human-readable data interchange. It is derived from the JavaScript scripting language for representing simple data structures and associative arrays, called objects. Despite its relationship to JavaScript, it is language-independent, with parsers available for most languages.
    The JSON format is often used for serializing and transmitting structured data over a network connection. It is used primarily to transmit data between a server and web application, serving as an alternative to XML.

    JSON是一种轻量级的数据交换格式。易于人阅读和编写,也易于机器解析和生成。JSON采用独立于语言的文本格式,但是也使用了类似C语言家族的习惯(包括C, C++, C#, Java, JavaScript等)。这些特性使JSON成为理想的数据交换语言。很多语言或库对JSON格式有非常好的支持,能方便的进行各种解析和操作。

    JSON基于两种结构:
    1. A collection of name/value pairs. In various languages, this is realized as an object, record, struct, dictionary, hash table, keyed list, or associative array.
    2. An ordered list of values. In most languages, this is realized as an array, vector, list, or sequence.

    JSON支持的格式规则:
    Number  (type not specified, but in practice double precision floating-point format, as this is how JavaScript in Web browsers treats it)
    String    (double-quoted Unicode (UTF-8 by default), with backslash escaping)
    Boolean (true or false)
    Array     (an ordered sequence of values, comma-separated and enclosed in square brackets; the values do not need to be of the same type)
    Object   (an unordered collection of key:value pairs with the ':' character separating the key and the value, comma-separated and enclosed in curly braces; the keys must be strings and should be distinct from each other)
    null       (empty)

    JSON格式数据举例:
    The following example shows the JSON representation of an object that describes a person. The object has string fields for first name and last name, a number field for age, contains an object representing the person's address, and contains a list (an array) of phone number objects.

    JSON Sample
    {
    "firstName": "John",
    "lastName" : "Smith",
    "age" : 25,
    "address" :
    {
    "streetAddress": "21 2nd Street",
    "city" : "New York",
    "state" : "NY",
    "postalCode" : "10021"
    },
    "phoneNumber":
    [
    {
    "type" : "home",
    "number": "212 555-1234"
    },
    {
    "type" : "fax",
    "number": "646 555-4567"
    }
    ]
    }
  • 相关阅读:
    python计算最大公约数和最小公倍数
    福利爬虫妹子图之获取种子url
    python位运算之计算中位数
    类的特殊成员方法,类的起源type, metaclass
    静态方法staticmethod类方法classmethod
    根据MAC地址前6位知道网络设备是哪家公司生产的
    「产检报告」简直是天书!!一张图教你看懂产检报告单
    第六周作业——选课系统
    面向对象银角大王补充2-self就是调用当前方法的对象-静态字段,公有属性-封装的理解-继承的理解,普通方法,静态方法
    面向对象银角大王补充-什么时候适用面向对象
  • 原文地址:https://www.cnblogs.com/KeithWang/p/2342995.html
Copyright © 2011-2022 走看看