check ritatools_dir not defined too and add json_last_error_msg()