You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

test2.c 1.1 kB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #ifdef NDEBUG
  2. #undef NDEBUG
  3. #endif
  4. #include <stddef.h>
  5. #include <stdio.h>
  6. #include <stdlib.h>
  7. #include <string.h>
  8. #include "json.h"
  9. #include "parse_flags.h"
  10. #ifdef TEST_FORMATTED
  11. #define json_object_to_json_string(obj) json_object_to_json_string_ext(obj, sflags)
  12. #else
  13. /* no special define */
  14. #endif
  15. int main(int argc, char **argv)
  16. {
  17. json_object *new_obj;
  18. #ifdef TEST_FORMATTED
  19. int sflags = 0;
  20. #endif
  21. MC_SET_DEBUG(1);
  22. #ifdef TEST_FORMATTED
  23. sflags = parse_flags(argc, argv);
  24. #endif
  25. new_obj = json_tokener_parse(
  26. "/* more difficult test case */"
  27. "{ \"glossary\": { \"title\": \"example glossary\", \"GlossDiv\": { \"title\": \"S\", "
  28. "\"GlossList\": [ { \"ID\": \"SGML\", \"SortAs\": \"SGML\", \"GlossTerm\": \"Standard "
  29. "Generalized Markup Language\", \"Acronym\": \"SGML\", \"Abbrev\": \"ISO 8879:1986\", "
  30. "\"GlossDef\": \"A meta-markup language, used to create markup languages such as "
  31. "DocBook.\", \"GlossSeeAlso\": [\"GML\", \"XML\", \"markup\"] } ] } } }");
  32. printf("new_obj.to_string()=%s\n", json_object_to_json_string(new_obj));
  33. json_object_put(new_obj);
  34. return EXIT_SUCCESS;
  35. }