-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
WIP: Add indent support in to_json #26457
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
Conversation
@@ -981,13 +996,17 @@ void encode(JSOBJ obj, JSONObjectEncoder *enc, const char *name, | |||
enc->iterBegin(obj, &tc); | |||
|
|||
Buffer_AppendCharUnchecked(enc, '{'); | |||
Buffer_AppendIndentNewlineUnchecked (enc); | |||
Buffer_AppendIndentUnchecked (enc, enc->level + 2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As mentioned this + 2
isn't permanent just a hack during WIP to get this to work. Something seems off with the level struct member I just haven't figured out yet
Codecov Report
@@ Coverage Diff @@
## master #26457 +/- ##
==========================================
- Coverage 91.73% 91.72% -0.01%
==========================================
Files 174 174
Lines 50754 50755 +1
==========================================
- Hits 46560 46557 -3
- Misses 4194 4198 +4
Continue to review full report at Codecov.
|
1 similar comment
Codecov Report
@@ Coverage Diff @@
## master #26457 +/- ##
==========================================
- Coverage 91.73% 91.72% -0.01%
==========================================
Files 174 174
Lines 50754 50755 +1
==========================================
- Hits 46560 46557 -3
- Misses 4194 4198 +4
Continue to review full report at Codecov.
|
Meant to open this as a draft PR - going to close to get it out of the queue but do plan on picking back up in the near term |
to_json
method #12004git diff upstream/master -u -- "*.py" | flake8 --diff
This is a WIP and requires a little more refinement (namely around how
level
is incremented in the extension module, testing arrays) but is more or less the direction I think we could head inThis is mostly inspired by changes done in ultrajson/ultrajson@930dfa5#diff-edae06c872e58ad6edf574f4414aac9f