CodeKit can do two things to JSON files:
- Minify them by removing whitespace and line breaks
- 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.
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.