Beispiel #1
0
static void test_file(const char *file)
{
    fprintf(stderr, "--- {{ test %s --- \n", file);
    size_t len;
    char *str = loadFile(file, &len);
    JSON json = parseJSON(str, str+len);
    size_t json_len;
    char *json_s = JSON_toStringWithLength(json, &json_len);
    fprintf(stderr, "'%s'\n", json_s);
    fprintf(stderr, "\n--- }} test %s --- \n", file);
    free(json_s);
    JSON_free(json);
    free(str);
}
Beispiel #2
0
static const char *JsonToNewText(KonohaContext *kctx, struct JsonBuf *jsonbuf)
{
	size_t length;
	const char *text = JSON_toStringWithLength(toJSON(jsonbuf->json_i), &length);
	return text; /* need free */
}