-
Notifications
You must be signed in to change notification settings - Fork 184
JSONEncoder can't encode what JSONDecoder decoded (they disagree on limits...) #1176
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
Comments
👀 The max number of depth is hardcoded as 💭 Not yet tested, but my guess is that the value of depth for decoding starts with swift-foundation/Sources/FoundationEssentials/JSON/JSONWriter.swift Lines 31 to 50 in 8c87e9e
|
@YOCKOW Does this need a fix? If so, can I look into opening a PR to address this? |
Sure, you can. I'm assigning you to this issue, thank you. |
Consider JSONs like
but deeper (for example
bug1.json
which has 255 levels). Now consider this program which decodes a thing and then reencodes it:You'd expect that
JSONEncoder
can encode everything thatJSONDecoder
decoded. But alas, here's what we see:bug1.json
The text was updated successfully, but these errors were encountered: