- Decodes the JSON text in file *path* and returns the array or
- object it contains, or *NULL* on error. If *error* is non-*NULL*,
- it's used to return error information. See below for more
- discussion on error reporting. *flags* is currently unused, and
- should be set to 0.
-
-
-The :type:`json_error_t` parameter, that all decoding function accept
-as their last parameter, is used to return information on decoding
-errors to the caller. It is used by having a ``json_error_t *``
-variable and passing a pointer to this variable to a decoding
-function. Example::
-
- int main() {
- json_t *json;
- json_error_t *error;
-
- json = json_load_file("/path/to/file.json", 0, &error);
- if(!json) {
- /* the error variable contains error information */
- fprintf(stderr, "Decoding error occured on line %d: %s\n", json_error_line(error), json_error_msg(error));
- free(error);
- }
-
- /* ... */
- }
+ All decoding functions also accept *NULL* as the
+ :type:`json_error_t` pointer, in which case no error information
+ is returned to the caller.