JSON Syntax: Transmitting an array

社会主义新天地 提交于 2019-12-04 00:28:30

Yes, your example is valid JSON - that is exactly how you want to use an array.

Edit : Here is a good link on JSON and its usage.

The not-very-well-known page json.org has a diagram that shows the syntax. It’s extremely simple to understand, IMHO.

Manish

Json Syntax Includes following.

 1. Data is represented in name/value pairs.
 2. Each name is followed by ':'(colon).
 3. The name/value pairs are separated by ,(comma).
 4. Json object starts and ends with '{' and '}'.
 5. Square brackets '[ ]' hold arrays and values are separated by
    ,(comma).

Json Objects Example

    {
    "id":"21",
    "language": "Json",
    "edition": "second",
    }

Json Array Example

  {
        "book": [
        {
        "id":"21",
        "language": "Json",
        "edition": "second"
        },
        {
        "id":"42",
        "language": "Json",
        "edition": "third"
        }]
        }

I have taken reference from http://www.tutsway.com/json-syntax.php

What you wrote up there is already correct :)

[{ "username" : "admin", "password" : "123" }, { "username" : "bbvb", "password" : "sdfsdf" }, { "username" : "asd", "password" : "222" }]
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!