Using NSJSONSerialization with fast on ubuntu / linux

Is it possible to parse JSON with NSJSONSerialization when running swift on ubuntu? As the ground is available, I guess it should be?

If not, is there another way to serialize and deserialize JSON in swift on linux?

+4
source share
3 answers

NSJSONSerialization partially implemented (serialization not yet implemented)

do it yourself, according to your needs, and you will see that this is the best investment and a great way to understand Swift and its capabilities. You can also use one of the open source libraries available. SwiftyJSON is very popular, for example,

As Sebastian Osinsky mentioned, unfortunately, he also uses NSJSONSerialization.

you can check out this simple but working swift json example . it’s far to be “perfect,” but as inspiration, it can help you, I hope so.

+2
source

TidyJSON , SwiftyJSON, NSJSONSerialization . , Swift, Swift/Ubuntu.

+2

If you use the Swift server-side platform "Perfect", you can do something like this to convert the "Binary" data types to the "JSONConvertable" object types (Swift Arrays, etc.).

do{
    let jsonObject = try String.init(data: jsonData, encoding: .utf8)?.jsonDecode()
    print("\(jsonObject as! [String])")
    }catch{
        response.completed(status: .badRequest)
        return
    }
0
source

Source: https://habr.com/ru/post/1622527/


All Articles