GO Online Toolset
home
search
feedback

Format json
6842  |   |   |  58

feature introduction

  1. Format or compress the formatted json string and support escape; uncomment will replace the #|//|-- according to the passing rule.
  2. Support escaping the string json contained in the string
  3. If the format is wrong, it will indicate which bit has the error.

example

1. In the correct format

{
    "name": "test", 
    "age": 10, 
    "addr": "Chengdu, Sichuan", 
    "cls_info": [{"name": "basketball class", "teacher": "teacher Zhang"}, {"name": "art class", "teacher": "Miss Li"}]
}

After treatment

{
    "name": "test",
    "age": 10,
    "addr": "Sichuan Chengdu",
    "cls_info": [
        {
            "name": "basketball class",
            "teacher": "Mr. Zhang"
        },
        {
            "name": "Art Class",
            "teacher": "Miss Li"
        }
    ]
}

2. Wrong format

{
    "name": "test", 
    "age": 10, 
    "addr": "Chengdu, Sichuan", 
    "cls_info": [{name": "basketball class", "teacher": "teacher Zhang"}, {"name": "art class", "teacher": "Miss Li"}]
}

After treatment

The error is as follows:

Sichuan and Chengdu "XXX" cls_info ": [{"

There is an error near XXX. Confirm whether the symbol is missing or redundant.

Note: an error occurred near XXX. It is recommended to search and check it.


3. Include json string

name=test&age=12&other={"name": "test", "age": 10, "addr": "Chengdu, Sichuan", "cls_info": [{"name": "basketball class", "teacher": "teacher Zhang"}, {"name": "art class", "teacher": "Miss Li"}]}

After treatment

name=test&age=12&other= {
    "name": "test",
    "age": 10,
    "addr": "Sichuan Chengdu",
    "cls_info": [
        {
            "name": "basketball class",
            "teacher": "Mr. Zhang"
        },
        {
            "name": "Art Class",
            "teacher": "Miss Li"
        }
    ]
}