All Projects → rhysd → fixjson

rhysd / fixjson

Licence: MIT license
JSON Fixer for Humans using (relaxed) JSON5

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to fixjson

Docformatter
Formats docstrings to follow PEP 257
Stars: ✭ 203 (+111.46%)
Mutual labels:  formatter
Stringformatter
Simple Text Formetter (Credit Card Number, Phone Number, Serial Number etc.) Can be used in all text inputs according to the format pattern. If desired, large minor character restrictions can be made in the format pattern.
Stars: ✭ 231 (+140.63%)
Mutual labels:  formatter
Mbeautifier
MBeautifier is a MATLAB source code formatter, beautifier. It can be used directly in the MATLAB Editor and it is configurable.
Stars: ✭ 248 (+158.33%)
Mutual labels:  formatter
Powershell Beautifier
A whitespace reformatter and code cleaner for Windows PowerShell and PowerShell Core
Stars: ✭ 213 (+121.88%)
Mutual labels:  formatter
Nginx Config Formatter
nginx config file formatter/beautifier written in Python.
Stars: ✭ 222 (+131.25%)
Mutual labels:  formatter
Prettyhtml
💅 The formatter for the modern web https://prettyhtml.netlify.com/
Stars: ✭ 241 (+151.04%)
Mutual labels:  formatter
Graphql Parser
A graphql query language and schema definition language parser and formatter for rust
Stars: ✭ 203 (+111.46%)
Mutual labels:  formatter
idea-uroborosql-formatter
Beautiful SQL Formatter for IntelliJ Platform
Stars: ✭ 18 (-81.25%)
Mutual labels:  formatter
Prettier Plugin Csharp
Prettier C# Plugin
Stars: ✭ 224 (+133.33%)
Mutual labels:  formatter
Formatting
Type-safe, functional string formatting in Swift.
Stars: ✭ 248 (+158.33%)
Mutual labels:  formatter
Godot Gdscript Toolkit
Independent set of GDScript tools - parser, linter and formatter
Stars: ✭ 214 (+122.92%)
Mutual labels:  formatter
Pp sql
Rails ActiveRecord SQL queries log beautifier
Stars: ✭ 223 (+132.29%)
Mutual labels:  formatter
Typescript Express Starter
🚀 TypeScript Express Starter
Stars: ✭ 238 (+147.92%)
Mutual labels:  formatter
Pronto
Quick automated code review of your changes
Stars: ✭ 2,450 (+2452.08%)
Mutual labels:  formatter
Best Of Python Dev
🏆 A ranked list of awesome python developer tools and libraries. Updated weekly.
Stars: ✭ 243 (+153.13%)
Mutual labels:  formatter
Uncrustify
Code beautifier
Stars: ✭ 2,442 (+2443.75%)
Mutual labels:  formatter
Webpack Messages
Beautifully format Webpack messages throughout your bundle lifecycle(s)!
Stars: ✭ 238 (+147.92%)
Mutual labels:  formatter
blackbricks
Black for Databricks notebooks
Stars: ✭ 40 (-58.33%)
Mutual labels:  formatter
Sublime-uroboroSQL-formatter
Beautiful SQL Formatter for Sublime Text 3
Stars: ✭ 25 (-73.96%)
Mutual labels:  formatter
Luaformatter
Code formatter for Lua
Stars: ✭ 244 (+154.17%)
Mutual labels:  formatter

JSON fixer for Humans

npm version ci-badge

fixjson is a JSON file fixer/formatter for humans using (relaxed) JSON5.

fixjson provides:

  • Pretty-printing JSON5 input
    • ES5 syntax is available to write up JSON
  • Fixes various failures while humans writing JSON
    • Fixes trailing commas objects or arrays
    • Fixes missing commas for elements of objects or arrays
    • Adds quotes to keys in objects
    • Newlines in strings
    • Hex numbers
    • Fixes single quotes to double quotes

fixjson reads an input in relaxed JSON5 format and outputs it in JSON format. Indent width is automatically detected.

This CLI tool aims to be used with editor extensions.

Screenshots of Fixes

When moving a line to another line, you no longer need to care about a trailing comma:

modify keys

And you also don't need to care about a trailing comma of a previous line when adding a new element to an object or an array:

add key

When adding a new key-value to an object, quotes of the key are fixed. And single quotes for strings are also fixed to double quotes:

key quotes

JSON string does not allow multi-line string. \n is required to embed multi-line string to JSON. fixjson automatically fixes newlines in strings. This is useful when copy&paste some string to JSON file:

newlines in string

JSON only accepts decimal digits for numbers. fixjson automatically converts 0x hex numbers to decimal numbers. You no longer need to convert hex numbers manually:

hex numbebr

And of course it pretty-prints the JSON code, with automatic indent detection:

pretty printing

Installation

$ npm install -g fixjson

It installs fixjson command globally.

Usage

fixjson [--write|--indent|--minify|--stdin-filename] [paths...]

If paths are given, glob such as dir/**/*.json is available. If the path is a directory, it formats all JSON files in the directory. If no path is given, it reads from STDIN.

If --write (or -w) option is provided, it overwrites files.

If --indent {num} (or -i {num}) is not provided, it detects indent spaces.

Please see fixjson --help for more details.

License

Distributed under the MIT License. Please see LICENSE.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].