minify json
strip spaces and line breaks from json to make it as small as possible for an api call, a config field or a url.
runs on your device · free · no sign-up
loading tool…
how to minify json
- paste your json into the box, or press sample to try it out.
- if it is invalid, read the line and column message and press jump to error to land on the problem.
- pick an indent, minify it, or turn on sort keys, then switch between text and tree view.
- type a path such as $.users[*].name to pull out values, then copy or download the result.
minifying changes only whitespace, never the data, so the values and the key order stay exactly as they were. because the json is parsed first, invalid input is caught before you copy it, which is handy when a trailing comma would otherwise break a request.
savings depend on how the file was formatted: pretty printed json with 4 space indents often drops by 30 percent or more, while compact json barely changes. if the file is served over http, gzip or brotli already removes most of the repetition, so minifying matters most for storage, local storage limits and embedded strings.
more ways to json formatter
frequently asked questions
does minifying change my data?
no. only whitespace between tokens is removed. whitespace inside strings is kept exactly as written.
how do i get it back to readable json?
change the indent from minified to 2 spaces, 4 spaces or tabs and the same data is shown formatted again.
can i minify json with comments?
comments are not valid json, so the parser will show an error. remove them first or use json5 tooling before minifying.