Integrate with JSON Parser to Realm Object
My project need a JSON parser which can integrate with Realm
class(easily) and back to JSON object with customizable transformer (basically nil to NSNull
)
I tried some of the high star JSON parser and write down my thought about them.
I prefer the Genome1.0
but recently it upgraded to 2.0 with some syntax changed
class BasicClass: Object {
dynamic var name: String = ""
dynamic var birthday: String = ""
dynamic var age: Int = 0
}
class BasicOptionalClass: Object {
var distance = RealmOptional<Int>()
dynamic var note: String? = nil
dynamic var value: Int = 0
}
- Need to use
final
on class since it useSelf
on protocol extension - Genome will throw error while encounter parsing issue
- Have method for transform object to
JSON
- Customizable JSON value representation
- since Genome return Json Object, you have to use
.foundationDictionary
or.anyValue
to getDictionary
orAnyObject
link: ObjectMapper+Realm
- ObjectMapper will set to default value while encounter parsing issue
- Have method for transform object to
JSON
but need to execute insideRealm
write transaction - Customizable JSON value representation (ex. return NSNull value)
- Have to include Curry or you will see brackets hell
- Argo will return nil object while encounter parsing issue
- Can not transform object to JSON
- Need to use
final
on class since it useSelf
on protocol extension - Gloss have the ability to customize action while encounter parsing issue(return nil for this example)
- Have method for transform object to
JSON
- Unbox can either return nil or throw error while encounter parsing issue
- Can not transform object to JSON
- Freddy will throw error while encounter parsing issue
- Provided nested json object parser
- Can not init with
Dictionary
, I useNSJSONSerialization
transformAnyObject
,Disctionary
to NSData - Not yet have inline transformer, issue
- Have method for transform object to
JSON
- Nested Json Transformer