#include <json.h>
+#include <pakfire/json.h>
#include <pakfire/package.h>
#include <pakfire/packagelist.h>
#include <pakfire/pakfire.h>
int r;
// Serialize the object as a JSON string
- const char* buffer = json_object_to_json_string_ext(object,
- JSON_C_TO_STRING_PRETTY|JSON_C_TO_STRING_PRETTY_TAB);
+ const char* buffer = pakfire_json_to_string(object);
// Print to the console
r = printf("%s\n", buffer);
#include <pakfire/hex.h>
#include <pakfire/i18n.h>
#include <pakfire/jail.h>
+#include <pakfire/json.h>
#include <pakfire/linter.h>
#include <pakfire/logging.h>
#include <pakfire/package.h>
}
DEBUG(archive->ctx, "Successfully parsed package metadata:\n%s\n",
- json_object_to_json_string_ext(archive->metadata,
- JSON_C_TO_STRING_PRETTY|JSON_C_TO_STRING_PRETTY_TAB));
+ pakfire_json_to_string(archive->metadata));
// Success
r = 0;
goto ERROR;
} else {
- ERROR(daemon->ctx, "Unknown message. Ignoring:\n%s\n",
- json_object_to_json_string_ext(m, JSON_C_TO_STRING_SPACED | JSON_C_TO_STRING_PRETTY));
+ ERROR(daemon->ctx, "Unknown message. Ignoring:\n%s\n", pakfire_json_to_string(m));
r = 0;
}
}
// Log what we have parsed
- DEBUG(ctx, "Parsed JSON:\n%s\n",
- json_object_to_json_string_ext(json,
- JSON_C_TO_STRING_SPACED | JSON_C_TO_STRING_PRETTY)
- );
+ DEBUG(ctx, "Parsed JSON:\n%s\n", pakfire_json_to_string(json));
ERROR:
if (tokener)
int r;
// Serialize the JSON object
- buffer = json_object_to_json_string_ext(json, 0);
+ buffer = pakfire_json_to_string(json);
if (!buffer) {
r = -errno;
goto ERROR;