Several formats of JSON string

1. JSON value ({ "key": value})

{
    "key" : 520,
    "key1" : 1314
}    

2. JSON string ({ "key": "value"})

{
    "key" : "我爱你",
    "key1" : "一生一世"
}

3. JSON array ({ "key": [value]})

{
    "key" : [520, 1314],
    "key1" : [520, 3344]
}

4. JSON object ({ "key": {value}})

{
    "key" : {"520": "我爱你"},
    "key1" : {"1314": "一生一世"}
}

5. JSON object array ({ "key": [{"key1": "value1"},{"key2": "value2"}]})

{
    "我" : [
                  {"key": "我爱你"},
                  {"key1": "一生一世"}
    ]
}

6. JSON array object ({"key":{"key1":[value1,value2]}})

{
    "我" : {
                  [520,1314],
                  ["我爱你", "一生一世"]
    }
}

The correct format of the json string, the front-end error disappears:

res.write('{"ok":true,"msg":"注册成功"}')

Guess you like

Origin blog.csdn.net/qq_44752641/article/details/114020842