Skip to content
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

[SR-2151] NSJSONSerialization.data(withJSONObject:options) produces illegal JSON code #4455

Closed
swift-ci opened this issue Jul 22, 2016 · 2 comments

Comments

@swift-ci
Copy link
Contributor

Previous ID SR-2151
Radar None
Original Reporter abinner (JIRA User)
Type Bug
Status Resolved
Resolution Done
Environment

Swift version 3.0 (swift-3.0-PREVIEW-2)
Target: x86_64-unknown-linux-gnu

Additional Detail from JIRA
Votes 0
Component/s Foundation
Labels Bug
Assignee DavidYangLiu (JIRA)
Priority Medium

md5: b9078e1e9b7a2c5c536f4a7d304e2f37

Issue Description:

When serializing Double values smaller than 1.0 and bigger than -1.0, the current implementation omits the leading "0". This is not allowed according to json.org and in fact the produced JSON code can't be parsed by the iOS/macOS implementation of NSJSONSerialization!

Example

Incorrect

{
    "foo": .1234
}

Should be

{
   "foo": 0.1234
}
@swift-ci
Copy link
Contributor Author

Comment by David Liu (JIRA)

Fixed and merged
#572

@swift-ci
Copy link
Contributor Author

Comment by David Liu (JIRA)

#572
pull request merged

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 5, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant