I have a json object like thies {"test" : "test"}, but if I convert it to a SwfiftyJSON.JSON object, and then I fetch the rawstring by function rawString(), then I convert the rawstring to a json object, but unfortunately, I can not get the correct json object, if I try to get "test" property or any other property, it always return nil, what is wrong?
SWIFT 5
If you want to get rid of white-spaces and new lines characters from your output, you should disable pretty Printing.
You can achieve this by
let myString = yourJsonObject.rawString(String.Encoding.utf8, options: JSONSerialization.WritingOptions.init(rawValue: 0))
Old versions
let myString = yourJsonObject.rawString(NSUTF8StringEncoding, options: NSJSONWritingOptions(rawValue: 0))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With