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

how to auto "prettify" json files #102

Open
kristiankauffeld opened this issue Sep 26, 2022 · 1 comment
Open

how to auto "prettify" json files #102

kristiankauffeld opened this issue Sep 26, 2022 · 1 comment

Comments

@kristiankauffeld
Copy link

kristiankauffeld commented Sep 26, 2022

When storing new session cookie, the json is written to the file on one line, ex.:

Screenshot 2022-09-26 at 16 51 42

versus this much more readable format:
Screenshot 2022-09-26 at 16 52 46

Is it possible to insert the json data, so that it's automatically formatted with spaces?

@kristiankauffeld kristiankauffeld changed the title how to auto "prettify" session data when created how to auto "prettify" json files Sep 26, 2022
@BillyWM
Copy link

BillyWM commented Feb 12, 2023

Have you tried passing an "encoder" method in the options? Docs say it defaults to json.stringify, which, without options, will not have spacing, but can take a space parameter. You could pass a simple function as the encoder like:
(x) => JSON.stringify(x, null, 4)

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