2020-03-28 10:25:00 +08:00
|
|
|
#include <stddef.h>
|
2007-03-13 08:26:18 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
|
|
#include "json.h"
|
2012-04-28 14:14:26 -05:00
|
|
|
#include "parse_flags.h"
|
|
|
|
|
|
|
|
|
|
#ifdef TEST_FORMATTED
|
2020-03-28 10:25:00 +08:00
|
|
|
#define json_object_to_json_string(obj) json_object_to_json_string_ext(obj, sflags)
|
2012-04-28 14:14:26 -05:00
|
|
|
#else
|
|
|
|
|
/* no special define */
|
|
|
|
|
#endif
|
2007-03-13 08:26:18 +00:00
|
|
|
|
|
|
|
|
int main(int argc, char **argv)
|
|
|
|
|
{
|
2012-09-16 20:43:29 -05:00
|
|
|
json_object *new_obj;
|
2012-04-28 14:14:26 -05:00
|
|
|
#ifdef TEST_FORMATTED
|
|
|
|
|
int sflags = 0;
|
|
|
|
|
#endif
|
2007-03-13 08:26:18 +00:00
|
|
|
|
2012-09-16 20:43:29 -05:00
|
|
|
MC_SET_DEBUG(1);
|
2007-03-13 08:26:18 +00:00
|
|
|
|
2012-04-28 14:14:26 -05:00
|
|
|
#ifdef TEST_FORMATTED
|
|
|
|
|
sflags = parse_flags(argc, argv);
|
|
|
|
|
#endif
|
|
|
|
|
|
2020-03-28 10:25:00 +08:00
|
|
|
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\"] } ] } } }");
|
2012-09-16 20:43:29 -05:00
|
|
|
printf("new_obj.to_string()=%s\n", json_object_to_json_string(new_obj));
|
|
|
|
|
json_object_put(new_obj);
|
2007-03-13 08:26:18 +00:00
|
|
|
|
2016-08-08 15:11:19 +02:00
|
|
|
return EXIT_SUCCESS;
|
2007-03-13 08:26:18 +00:00
|
|
|
}
|