Skip to content

[4.0] Encode Decimal as a numeric value in JSON #10553

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

Merged

Conversation

itaiferber
Copy link
Contributor

What's in this pull request?
Cherry-picks #10539 to swift-4.0-branch.

Explanation: Allow JSONEncoder/JSONDecoder to intercept Decimal values so they get a numeric representation in JSON (instead of their default keyed implementation).
Scope: Affects those who want to read large decimal values representable by Decimal natively from JSON.
Radar: rdar://problem/32926804
Risk: Low
Testing: Adds unit tests to confirm expected behavior.

Allow JSONEncoder/JSONDecoder to intercept Decimal values so they get
a numeric representation in JSON (instead of their default keyed
implementation).
@itaiferber
Copy link
Contributor Author

@swift-ci Please test macOS

@itaiferber
Copy link
Contributor Author

@swift-ci Please smoke test Linux

@itaiferber
Copy link
Contributor Author

@swift-ci Please test macOS

@itaiferber
Copy link
Contributor Author

@swift-ci Please test Linux

@tkremenek tkremenek merged commit c179be4 into swiftlang:swift-4.0-branch Jun 27, 2017
@itaiferber itaiferber deleted the 4.0-foundation-json-decimal branch June 27, 2017 16:24
@itaiferber
Copy link
Contributor Author

@tkremenek Thanks!

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

Successfully merging this pull request may close these issues.

2 participants