ce9d87361216a3a7e5116e216a66d6f98eeaff84
[jansson.git] / test / loadf_dumpf.c
1 #include <stdio.h>
2 #include <jansson.h>
3
4 int main(int argc, char *argv[])
5 {
6     json_t *json;
7     json_error_t error;
8
9     if(argc != 1) {
10         fprintf(stderr, "usage: %s\n", argv[0]);
11         return 2;
12     }
13
14     json = json_loadf(stdin, &error);
15     if(!json) {
16         fprintf(stderr, "%d\n%s\n", error.line, error.text);
17         return 1;
18     }
19
20     /* loadf_dumpf indents, others don't, so dumping with and without
21        indenting is tested */
22     json_dumpf(json, stdout, JSON_INDENT(4));
23     json_decref(json);
24
25     return 0;
26 }