Use jsonviewer to check whether JSON data is legal by yulh

Source: Internet
Author: User
Tags jsonviewer

In the project, the data is read to the able, and then converted to the JSON format by converting the period to the front-end page for processing. However, due to the JSON data format, errors are often reported when the data arrives at the location where the script is processed due to invalid characters in the data record. The most common problems are the lack of curly braces and string truncation, this article does not focus on the special character processing methods in JSON data, but on how to locate data problems. Of course, the most important thing is to standardize the data source.

The tool used today is jsonviewer, which is a JSON data viewer that can format JSON data, check data errors, and perform location operations.

The interface is as follows:

Usage: paste the JSON data string to the "text" window. The tool automatically checks the data, if there is an error in the data format, it is described in red below the window. Click the red letter to locate the error.

In this example, it is obvious that the value has a problem. If the double quotation marks are added, the problem is found. Handle it:

"Rznr": "parsing files"Sq200907232000.03126"Data in may fail because the file contains error data"

Change

"Rznr": "parsing data in the sq200907232000.03126 file failed, possibly because the file contains Error Data"

With the deletion of double quotation marks,ProgramThe check results are also automatically updated, such:

Next we will format the JSON data:

The neatly arranged data comes out. Finally, we can use "Viewer" to view the key values, just like the height in ,:

Conclusion: This tool is helpful in adjusting JSON format data. I basically use this tool when using jquery Ajax for data processing. I hope it will be helpful to you.

: Jsonviewer

----------

By yulh

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.