Features Videos Help About Updates
Menu Buy Now

Languages: JSON

First Steps:
Getting Started
Live-Reload Browsers
Browser Sync
Set Language Options
Set Output Paths & Action
Second Steps:
Defaults For New Projects
Build Your Project
Set Target Browsers
Stuff To Know:
CodeKit + Git
Troubleshooting
License Recovery
PostCSS Tools:
Autoprefixer
PurgeCSS
Custom PostCSS Plugins
Other Tools:
npm
Babel — (JS Transpiler)
Terser — (JS Minifier)
Rollup — (JS Bundler)
Cache-Buster
HTML-Minifier
LightningCSS
Bless
Languages:
Sass
Less
Stylus
JavaScript
CoffeeScript
TypeScript
Pug
Haml
Slim
Kit
Markdown
JSON
Image Optimizers:
WebP
PNG
JPEG
SVG
GIF
Frameworks:
CodeKit Frameworks
Tailwind
Bootstrap
Bourbon
Bitters
Zurb Foundation
Susy
Nib
Jeet
Syntax Checkers:
ESLint
Advanced:
Hooks
Environment Variables
Adding Custom Languages
Team Workflows
Scripting CodeKit
Editor Plugins:
Nova
Atom
Sublime Text
Coda 2
More
Read-Only Mode
Upgrading From 2.0
FAQ

CodeKit can do two things to JSON files:

  1. Minify them by removing whitespace and line breaks
  2. Order Key-Value pairs alphabetically
Why Alphabetize?

If you need to commit a JSON file to a Git repository, alphabetizing the contents makes seeing diffs much easier. Most raw JSON files are unsorted because the spec does not require any particular ordering.


JSON Options

First, make sure you've read Setting Language Options.

A screenshot of the JSON file inspector in the CodeKit window

Like all languages in CodeKit, you can set processing options for all JSON files at once in Project Settings > Languages > JSON or you can customize settings on a file-by-file basis by selecting one JSON file in the list and using the Inspector Pane.

Output Style

Choose the compressed output style to minify JSON files, or the regular output style to pretty-print them.

Alphabetize

Check the box to alphabetize Key-Value pairs.


Setting Output Paths

See Setting Output Paths.


Implementation Details

CodeKit's JSON engine is written in C and is massively fast. It's actually the same component that writes the config.codekit3 file for your project. In testing, a file with roughly 350,000 entries was minified, ordered, and written instantaneously.

Syntax Errors

Your JSON file must be well-formed. If it contains a syntax error, CodeKit will inform you that parsing the contents of the file failed. Look for unclosed braces, missing commas, unclosed quotes, etc.

Made in San Diego, CA

Follow the Developer on Twitter

Email Support

Report a Bug

Privacy Policy