Which Swift JSON library do you recommend?


#1

Is there a JSON library that developers or CB recommend for working with iOS / Swift 4?

More specifically is there a library to help deal with data* that sync gateway delivers to iOS so that the JSON data can be quickly and easily serialised to classes/objects/enums etc?

*the not quite JSON and not quite Swift dictionary


#2

We don’t recommend anything specific but I have personally liked Swift Codables for encoding / decoding from JSON/ Swift Objects. Of course you would still need to map the native objects (“POSO”) to Document types. This repo is a bit dated (a year ago) but the concepts should apply to latest swift version - feel free to submit a PR if you update it to latest :slight_smile:


Converting objects to dictionaries and back
#3

Thanks Priya. I’ll investigate this.

Q : POSO?


#4

Plain Old Swift Object


#5

We don’t expose JSON at all in our API, so I don’t think a Swift JSON library will be any help working with CBL.