json-minify Minify and compress JSON
Examples
Minify a formatted JSON object
Usage
"{
"name": "Alice",
"age": 30
}" | json-minify Compress JSON for embedding in a URL parameter
Usage
"{
"query": "SELECT *",
"params": {
"limit": 10,
..." | json-minify Minify a JSON config to a single line for copying
Usage
"{
"theme": "dark",
"fontSize": 14,
"autoSave": true
}" | json-minify View source
(input)=>{
try {
return JSON.stringify(JSON.parse(input));
} catch (e) {
return `Error: ${e.message}`;
}
}