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.0 kB

1234567891011121314151617181920212223242526272829
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <stddef.h>
  4. #include <string.h>
  5. #include "json.h"
  6. #include "parse_flags.h"
  7. #ifdef TEST_FORMATTED
  8. #define json_object_to_json_string(obj) json_object_to_json_string_ext(obj,sflags)
  9. #endif
  10. int main(int argc, char **argv)
  11. {
  12. json_object *new_obj;
  13. #ifdef TEST_FORMATTED
  14. int sflags = 0;
  15. sflags = parse_flags(argc, argv);
  16. #endif
  17. MC_SET_DEBUG(1);
  18. new_obj = json_tokener_parse("/* more difficult test case */"
  19. "{ \"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\"] } ] } } }");
  20. printf("new_obj.to_string()=%s\n", json_object_to_json_string(new_obj));
  21. json_object_put(new_obj);
  22. return EXIT_SUCCESS;
  23. }