The dreaded JSON syntax error!
We are deeply dependent on JSON data. And syntax error in JSON data can become a disaster ranging from breaking an API, a deployment or the whole application.
More often than not we keep JSON files as configuration in Github. These JSON files can be application configuration, deployment configuration etc.
We tend to edit them directly from Github to avoid cloning the whole repository. And as Github’s own editor doesn’t have any sort of validation for checking the syntax of the JSON file being saved, we sometimes save these JSON files with syntax error which results in app runtime error.
There is this chrome plugin which helps you make sure you are not saving wrong JSON and keeps your JSON formatted.
Steps to use it:
1. Install this plugin from Chrome web store
https://chrome.google.com/webstore/detail/github-json-editor/ojkpalfdidhnipfgeaaopjfkgemancnd
2. Now open any JSON file on Github. You shall see a button labelled ‘JSON Editor’. Click on that button
3. Plugin will open in a new tab. Please make sure to save your settings when opening the plugin for very first time.
Click on Settings
button to save your Github configuration
4. After saving the settings it will automatically refresh the page and load the JSON in the editor.
5. Now you can make any changes to JSON and finally click ‘Save’ button to commit your changes to your repository.
From now on this plugin will be your saviour and guide for editing JSON files in Github!
Enjoy.