You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
dumps with WM_PRETTY not indented by 4 spaces when keys are int #191
Assuming the "however, it prints" comes from something else: you are passing a str, and that will be emitted as such, surely not at a prettified dictionary.
Why are you expecting that?
I'm sorry, but I'm afraid that cannot work, the underlying rapidjson library adheres to standard JSON (with just a few exceptions), and a JSON object requires string keys. As said, if you pass a string to dumps(), there is no way that it will discover that it contains an (invalid) JSON representation, parse it and redump the result as a pretty formatted JSON.
Activity
lelit commentedon Oct 26, 2023
Assuming the "however, it prints" comes from something else: you are passing a
str, and that will be emitted as such, surely not at a prettified dictionary.Why are you expecting that?
jamesbraza commentedon Oct 26, 2023
HA my bad, I pasted in the wrong thing, editing my OP 😅.
I guess my expectation comes from https://python-rapidjson.readthedocs.io/en/latest/dumps.html's section on
WM_PRETTYprinting with an indent of 4 spaces.Basically I am trying to pretty print a blob with
intkeys. I am:lelit commentedon Oct 26, 2023
I'm sorry, but I'm afraid that cannot work, the underlying
rapidjsonlibrary adheres to standardJSON(with just a few exceptions), and aJSONobject requires string keys. As said, if you pass a string todumps(), there is no way that it will discover that it contains an (invalid)JSONrepresentation, parse it and redump the result as a pretty formattedJSON.jamesbraza commentedon Oct 26, 2023
Yeah I was also experimenting with this:
Unfortunately, it gives the same results. Thanks for confirming my intuitions here, going to close this out
jamesbraza commentedon Oct 26, 2023
Thanks again, appreciated btw!
lelit commentedon Oct 26, 2023
It turns out that something is wrong with
write_mode...lelit commentedon Oct 26, 2023
FTR, commit 8b5fe38 fixes the issue with
write_mode.lelit commentedon Oct 26, 2023
Sigh, that commit references the wrong issue 😶🌫️