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

[pretty_format_json] Add compact array feature #1148

Closed
wants to merge 1 commit into from

Conversation

adithyabsk
Copy link

Note: in the process of testing this patch, I noticed that we have a round trip related bug when using json.loads followed by json.dump when dealing with small numbers (which get converted to scientific notation) and some scientific notation numbers that get converted to numbers which is undesirable, but of scope of this change.

@asottile
Copy link
Member

please discuss features before wasting time on them

I cannot accept a regex hack unfortunately and I don't think this is a good idea anyway -- invites more bikeshedding

@asottile asottile closed this Mar 18, 2025
@adithyabsk
Copy link
Author

adithyabsk commented Mar 19, 2025

please discuss features before wasting time on them

Upstream was a curtesy, plan to use the fork to unblock myself. Understand if you cannot accept the change.

If you have suggestions on a better approach, I'm open to changing the implementation (to a more mergable version). My use case was that I had some configs that were numeric array heavy that needed to be human readable. The default behavior made the json file too big.

I noticed that we have a round trip related bug

Spent some time to see if there were round trip stable json parsers but came up short. simplejson may be an option, but I didn't try it.

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

Successfully merging this pull request may close these issues.

2 participants