Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: add a minify command (opposite of beautify) #32

Closed
Fuco1 opened this issue May 10, 2017 · 2 comments
Closed

Feature request: add a minify command (opposite of beautify) #32

Fuco1 opened this issue May 10, 2017 · 2 comments

Comments

@Fuco1
Copy link

Fuco1 commented May 10, 2017

Sometimes it would be handy to be able to minify the json back to a "single row". Just doing naive replacement of whitespace might break the content of strings so I think this would require some minimal parsing. Or maybe just adjusting the output of the beautifier with some settings.

@gongo
Copy link
Owner

gongo commented May 10, 2017

Hi @Fuco1

Thanks for request. But sorry, this library is formatter (beautifier).
minify is not the role of this library. 🙇

@gongo gongo closed this as completed May 10, 2017
@Fuco1
Copy link
Author

Fuco1 commented May 10, 2017

I wasn't aware of the built-in library. What I want can be done simply with

(let* ((p (point))
       (json (json-read)))
  (delete-region p (point))
  (save-excursion
    (insert (json-encode json))))

Thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants