CBJSONEncoder NSDate

20 views
Skip to first unread message

manu.t...@gmx.fr

unread,
Nov 14, 2014, 7:37:55 AM11/14/14
to mobile-c...@googlegroups.com
Hi,

Why CBJSONEncoder: encodeNestedObject does not know encode NSDate?

--
Manu


Jens Alfke

unread,
Nov 14, 2014, 5:32:28 PM11/14/14
to mobile-c...@googlegroups.com

On Nov 14, 2014, at 4:37 AM, manu.t...@gmx.fr wrote:

Why CBJSONEncoder: encodeNestedObject does not know encode NSDate?

Because it only encodes the standard JSON types: null/bool/number/string/array/dictionary.
(It's basically a replacement for NSJSONSerialization.)

Encoding other types is problematic because you don't get round-trip fidelity: if you encode an NSDate as a string, then it will decode back to an NSString, not an NSDate.

—Jens
Reply all
Reply to author
Forward
0 new messages