In the development process, we often need to process JSON data, especially to verify whether the JSON data is legal, but many tools simply return a sentence "JSON format is correct" or "JSON format is incorrect", without pointing out the specific error position, making me or most users very frustrated.
So I want to develop a tool myself, so I can verify the JSON data more conveniently and point out the specific error position.
I originally wanted to use Monaco Editor for this tool, but Monaco Editor's size is too large, I worry about affecting the browser's performance, after all, we only need simple verification and display.
So I thought of using textarea for this tool, but textarea itself is too simple, I worry about affecting the user's experience, so I added some line numbers, status bar and highlighting on the textarea basis.
The JSON format and compression use the js native API, without depending on any third-party libraries, so the tool page loading speed is very fast.
The hardest part of this tool is how to locate the most specific error position, which is the core function of this tool. I finally chose to use regular expressions to implement this function, although regular expressions are flexible, it is very complex to implement, I spent a lot of time debugging.
Although there are still some error scenarios that are not covered, most of the error scenarios such as missing commas, null value detection, bracket closure, etc. can be detected. Hope this tool can help you. ^_^
A: No. All JSON formatting is done locally in your browser and will not be uploaded to any server.
JSON: JavaScript Object Notation, a lightweight data exchange format
JSON string: JSON data wrapped in double quotes
Free online format TypeScript and TSX code
Free online generate QR code
Quickly compare dependencies and version differences between two package.json files
Free online compress image
Free online decode QR code
Explore more useful tools to improve your productivity