Question: swift byte[] in json object

Question

swift byte[] in json object

Answers 1
Added at 2016-12-21 16:12
Tags
Question

I'm trying to serialize json object like this

let jsonObject: [String: Any] = [
        "Description":problemDescription.text!,
        "Photo": byteArray
    ]
let jsonData = try! NSJSONSerialization.dataWithJSONObject(jsonObject, options: .PrettyPrinted)

but I'm getting this type of error:

swift 2 argument type string any does not conform to expected type any object.

Any ideas?

Answers to

swift byte[] in json object

nr: #1 dodano: 2016-12-22 10:12

update: It seems that when I'm printing json object after this line

let jsonData = try! NSJSONSerialization.dataWithJSONObject(jsonObject, options: .PrettyPrinted)

that that conversion to byte[] occurs itself. At least seems that way in console debug.

Source Show
◀ Wstecz