Init with string gives nil
LinusGeffarth opened this issue · comments
Linus commented
I'm trying to init JSON
using JSON(string: String)
but when printing the json variable as string, it says nil
.
Now, the string I'm using is valid. I verified that by uploading it to my server and then initializing JSON
using JSON(url: String)
. That printed as string gives me the right result.
Any ideas / workarounds? Thanks!
Linus commented
Nevermind, it only printed nil because I was doing print(JSON(string: myStr).asString)
. This, however, works: print(JSON(string: myStr))