Object-orientated wrapper for json_encode() and json_decode() that also handles errors.