Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upIssue with docs and version 4 when converting data to JSON #912
Comments
|
@jethmalani Hi thanks for this issue. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment


What did you do?
When I do this (from your docs):
guard let dataFromString = text.data(using: .utf8, allowLossyConversion: false) else {return} let json = JSON(data: dataFromString)I get an error "Call can throw, but it is not marked with 'try' and the error is not handled"
I did this. I just want to confirm that is right. It worked for me.
guard let dataFromString = text.data(using: String.Encoding.utf8, allowLossyConversion: false) else {return} var json:JSON! do { json = try JSON(data: dataFromString) } catch { print("Error JSON: \(error)") }Please replace this with what you did.
What did you expect to happen?
Please replace this with what you expected to happen.
What actually happened instead?
Please replace this with what happened instead.
Environment
List the software versions you're using:
Xcode Default.)Please also mention which package manager you used and its version. Delete the
other package managers in this list:
pod --versionin Terminal)carthage versionin Terminal)swift build --versionin Terminal)Project that demonstrates the issue
Please link to a project we can download that reproduces the issue. Feel free
to delete this section if it's not relevant to the issue (eg - feature request).
The project should be short, self-contained, and correct example.