added wrapper for json_t so that it is properly memory manager e.g. if an exception is thrown