Control formatting with `dump` / `dumps`
See original GitHub issueIs there any way to control JSON5 aspects of formatting when using dump
/ dumps
? For example, whether to quote key names of objects, or whether to include trailing commas.
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Formatting system dumps - IBM
Formatting system dumps. You can process system dumps from the dump data set by invoking the interactive problem control system (IPCS).
Read more >JSON dumps custom formatting - python - Stack Overflow
I have used the example provided by Tim Ludwinski and adapted it to my preference: class CompactJSONEncoder(json.JSONEncoder): """A JSON Encoder that puts ...
Read more >Documentation: 15: 26.1. SQL Dump - PostgreSQL
You can control the degree of parallelism with the -j parameter. Parallel dumps are only supported for the "directory" archive format. pg_dump -j...
Read more >OpenVMS DCL Dictionary
By default, the DUMP command formats the output both in ASCII characters and in hexadecimal longwords. You can specify another format for the...
Read more >dump command - LAMMPS documentation
The atom, custom, grid, and local styles create files in a simple LAMMPS-specific text format that is self-explanatory when viewing a dump file....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes, it should quote keys with spaces properly. I could imagine a single/double quote flag to be useful, though.
Yes, both of those things are supported, in fact 😃.
Unfortunately at the moment I don’t have this lifted into obvious documentation (which I should fix), but if you look at the docstring for
dumps
:https://github.com/dpranke/pyjson5/blob/main/json5/lib.py#L154
json5.dumps
supports all of the args ofjson.dumps
, plus three additional ones:allow_duplicate_keys
,quote_keys
, andtrailing_commas
. If you have other formatting options you’d like to see, I’m open to hearing about them 😃.