I'm using NSJSONSerialization dataWithJSONObject to serialize my classes to JSON. When it serializes a BOOL, it gives it the value 1 or 0 in the JSON string. I need this to be true or false instead. Is this possible to do generically?
No, the Foundation Object for a Bool is
numberWithBool, which becomes either 0 or 1. We have no
Bool Object. Same go for reading
JSON. True/false will become a
You could create an
Bool Class and build your own parser. Arrays are Arrays and
JSON Objects are
NSDictionary. You can query the keys, test what Class lies behind and build the
JSON String from this.