From 48e42dce5660cfb753546b2f3bf8fbc3ccc208be Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Fri, 3 Sep 2021 12:40:09 +0100 Subject: [PATCH] Use the same JSON schema in the database as the upload I mistakenly told Kate there was no existing format, but of course there is, and it makes sense for the formats to be the same. --- src/fu-security-attr.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/fu-security-attr.c b/src/fu-security-attr.c index b96264866..85ac52593 100644 --- a/src/fu-security-attr.c +++ b/src/fu-security-attr.c @@ -260,14 +260,12 @@ fu_security_attr_get_result(FwupdSecurityAttr *attr) * fu_security_attrs_to_json_string() converts FuSecurityAttrs and return the * string pointer. The converted JSON format is shown as follows: * { - * "SecurityAttrs": { - * "Attrs": [ - * { - * "name": "aaa", - * "value": "bbb" - * } - * ] - * } + * "SecurityAttributes": [ + * { + * "name": "aaa", + * "value": "bbb" + * } + * ] * } * * Returns: A string and NULL on fail. @@ -303,10 +301,9 @@ fu_security_attrs_to_json(FuSecurityAttrs *attrs, JsonBuilder *builder) { g_autoptr(GPtrArray) items = NULL; g_autoptr(GError) error = NULL; + json_builder_begin_object(builder); - json_builder_set_member_name(builder, "SecurityAttrs"); - json_builder_begin_object(builder); - json_builder_set_member_name(builder, "Attrs"); + json_builder_set_member_name(builder, "SecurityAttributes"); json_builder_begin_array(builder); items = fu_security_attrs_get_all(attrs); for (guint i = 0; i < items->len; i++) { @@ -317,5 +314,4 @@ fu_security_attrs_to_json(FuSecurityAttrs *attrs, JsonBuilder *builder) } json_builder_end_array(builder); json_builder_end_object(builder); - json_builder_end_object(builder); }