MACSio  0.9
Multi-purpose, Application-Centric, Scalable I/O Proxy App
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
test2.c
Go to the documentation of this file.
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <stddef.h>
4 #include <string.h>
5 
6 #include "json.h"
7 #include "parse_flags.h"
8 
9 #ifdef TEST_FORMATTED
10 #define json_object_to_json_string(obj) json_object_to_json_string_ext(obj,sflags)
11 #else
12 /* no special define */
13 #endif
14 
15 
16 int main(int argc, char **argv)
17 {
18  json_object *new_obj;
19 #ifdef TEST_FORMATTED
20  int sflags = 0;
21 #endif
22 
23  MC_SET_DEBUG(1);
24 
25 #ifdef TEST_FORMATTED
26  sflags = parse_flags(argc, argv);
27 #endif
28 
29  new_obj = json_tokener_parse("/* more difficult test case */ { \"glossary\": { \"title\": \"example glossary\", \"GlossDiv\": { \"title\": \"S\", \"GlossList\": [ { \"ID\": \"SGML\", \"SortAs\": \"SGML\", \"GlossTerm\": \"Standard Generalized Markup Language\", \"Acronym\": \"SGML\", \"Abbrev\": \"ISO 8879:1986\", \"GlossDef\": \"A meta-markup language, used to create markup languages such as DocBook.\", \"GlossSeeAlso\": [\"GML\", \"XML\", \"markup\"] } ] } } }");
30  printf("new_obj.to_string()=%s\n", json_object_to_json_string(new_obj));
31  json_object_put(new_obj);
32 
33  return 0;
34 }
int main(int argc, char **argv)
Definition: test2.c:16
int parse_flags(int argc, char **argv)
Definition: parse_flags.c:28
#define MC_SET_DEBUG(x)
Definition: debug.h:60
int json_object_put(struct json_object *obj)
Definition: json_object.c:155
const char * json_object_to_json_string(struct json_object *obj)
Definition: json_object.c:295
struct json_object * json_tokener_parse(const char *str)
Definition: json_tokener.c:158