Simple JSON

Time:2019-9-11

Basic concepts

JSON(JavaScript Object Notation)A lightweight data structure widely used for data transmission in networks.

Two structures

  • Name / value pairA collection similar to that in PythonDictionaries
  • valueSequential lists, similar to those in Javaarray

Mark

  • Curly braces(‘{‘,’}’): Indicates aobject
  • Middle brackets(‘[‘,’]’): Indicates aarray
  • comma(‘,’): RepresentationParataxis
  • whateverBlank character(Spaces, carriage return, tabs, etc.): For visual pleasure.

value

  • String: The style of C language, which can contain escaped characters, usingUnicodeCharacter,
  • Number: C Language Style, Availablee/ETo count scientifically, decimals, etc.
  • True: “True”.
  • False: “false”.
  • Null: means no content.
  • Object: As mentioned aboveName / value pairSet,
  • Array:valueThere are sequential lists.

Examples and others

As you can see from the above, JSON can be infinitenesting
An example (JSON object):

json{
    "name": "Tom",
    "age": 29,
    "gender": true,
    "contact": [
        "office": "1234-7654321",
        "private": "13812345678"
    ],
}

An example (JSON array):

json[
    "Tom": {
        "title": "professor",
        "department": "logistic",
        "salary": 6516.52
    },
    "Jerry": {
        "title": "teacher",
        "department": "logistic",
        "salary": 4358.64
    }
]