Wrapper for json_encode and json_decode with Exceptions