return NULL;
}
#endif
+
+
+/**
+ * virJSONStringReformat:
+ * @jsonstr: string to reformat
+ * @pretty: use the pretty formatter
+ *
+ * Reformats a JSON string by passing it to the parser and then to the
+ * formatter. If @pretty is true the JSON is formatted for human eye
+ * compatibility.
+ *
+ * Returns the reformatted JSON string on success; NULL and a libvirt error on
+ * failure.
+ */
+char *
+virJSONStringReformat(const char *jsonstr,
+ bool pretty)
+{
+ virJSONValuePtr json;
+ char *ret;
+
+ if (!(json = virJSONValueFromString(jsonstr)))
+ return NULL;
+
+ ret = virJSONValueToString(json, pretty);
+
+ virJSONValueFree(json);
+ return ret;
+}
virJSONValuePtr virJSONValueCopy(const virJSONValue *in);
+char *virJSONStringReformat(const char *jsonstr, bool pretty);
+
#endif /* __VIR_JSON_H_ */