Patch for CJSON to support JsonSerializable.

As mentioned in #2540, this patch allows CJSON to use the interface if available.