zoukankan      html  css  js  c++  java
  • Introduction to JSON

    JSON (JavaScript Object Notation) is most widely used data format for data interchange on the web. This data interchange can happen between two computers applications at different geographical locations or running within same hardware machine.

    The good thing is that JSON is a human and machine readable format. So while applications/libraries can parse the JSON data – humans can also look at data and derive meaning from it.

    A JSON document may contains text, curly braces, square brackets, colons, commas, double quotes, and maybe a few other characters.

    Primarily, JSON is built on two structures:

    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.
    An ordered list of values. In most languages, this is realized as an array, vector, list, or sequence.

    JSON Example
    A sample JSON document looks like this:

    //JSON Object

    {  
        "employee": {  
            "id":           1,
            "name":         "Admin",   
            "location":     "USA"
        }  
    }
    

    //JSON Array

    {  
        "employees": [
                     {  
                        "id":           1,
                        "name":         "Admin",   
                        "location":     "USA"
                     },
                     {  
                        "id":           2,
                        "name":         "User",   
                        "location":     "USA"
                     },
                     {  
                        "id":           3,
                        "name":         "User2",   
                        "location":     "USA"
                     }
        ]  
    }
    

    As you can see, JSON data consists of name/value pairs. These name/value pairs reflect the structure of the data.

    Learn JSON
    In this tutorial, we will learn various concepts about JSON with examples. Such as:

    Difference with XML
    Syntax and data types
    How to read JSON data
    How to write JSON data
    Convert JSON to String and vice-versa etc.

  • 相关阅读:
    Javascript-逻辑运算符(&&)
    Javascript-蔬菜运算价格
    Javascript-涨工资案例
    Javascript-数据类型转换
    Javascript-数据类型转换 、 运算符和表达式
    HTML5表单及其验证
    /*使用PHP创建一个数组,保存5個员工的信息(ename/sex/salary/birthday/pic)*/
    CERC2013(C)_Magical GCD
    UVA12546_LCM Pair Sum
    UVA12545_Bits Equalizer
  • 原文地址:https://www.cnblogs.com/PrimerPlus/p/12913865.html
Copyright © 2011-2022 走看看