gron is a grep-like tool that specializes in JSON format. Unlike grep, however, it works both way – in and out.
Tag: JSON
Automerge – a JSON-like data structure for concurrent multi-user editing
Collaborative editing is a very challenging subject, technically speaking. The old days of users editing a file, sending it to another user, and back are long gone. Version control tools like git helped with tracking changes and resolving conflicts. But the newer generation of tools – Google Docs for example – push the bar even higher. Now many users expect real-time, transparent collaborative tools, which allow multiple users to work on the same document at the same time and without any additional technical complexity.
Automerge is one project that helps the developers to build such collaborative tools, by providing a library of JSON-like data structures, which can be edited in parallel and then merged back together.
Automerge […] supports automatic syncing and merging:
- You can have a copy of the application state locally on several devices (which may belong to the same user, or to different users). Each user can independently update the application state on their local device, even while offline, and save the state to local disk.(Similar to git, which allows you to edit files and commit changes offline.)
- When a network connection is available, Automerge figures out which changes need to be synced from one device to another, and brings them into the same state.(Similar to git, which lets you push your own changes, and pull changes from other developers, when you are online.)
- If the state was concurrently changed on different devices, Automerge automatically merges the changes together cleanly, so that everybody ends up in the same state, and no changes are lost.(Different from git: no merge conflicts to resolve!)
JSON Server
JSON Server is a handy tool for anybody working with or developing the REST/JSON APIs. It’s a ready-made “fake” API server, that is super easy to setup with your end points and your data. And the best part – it’s not just read-only. You can work with POST, PUT, PATCH, and DELETE requests too and the JSON Server will properly update your pre-configured data in the JSON files.
JSON5 – JSON for Humans
JSON5 specification looks like a much more useful JSON, especially for those of us who are still more human than machine. Here are some of the improvements:
- Objects and arrays can have trailing commas.
- Strings can be single-quoted.
- Strings can have line breaks.
- Numbers can be signed, begin or end with a decimal point, and also in base 16.
- Inline and block comments are supported.
Here’s an example:
{ foo: 'bar', while: true, this: 'is a \ multi-line string', // this is an inline comment here: 'is another', // inline comment /* this is a block comment that continues on another line */ hex: 0xDEADbeef, half: .5, delta: +10, to: Infinity, // and beyond! finally: 'a trailing comma', oh: [ "we shouldn't forget", 'arrays can have', 'trailing commas too', ], }
jq and jo – handy CLI tools for working with JSON
Here are a couple of really useful command-line tools for anybody working with JSON. The first one is jq, which is a somewhat wider known JSON processor. Here’s a nice tutorial with many examples of how this tool is useful. The second one, is jo – a command-line tool for easier creation of JSON output.