Remove brace initialization of json objects

Brace initialization of json objects, while quite interesting from an
academic sense, are very difficult for people to grok, and lead to
inconsistencies.  This patchset aims to remove a majority of them in
lieu of operator[].  Interestingly, this saves about 1% of the binary
size of bmcweb.

This also has an added benefit that as a design pattern, we're never
constructing a new object, then moving it into place, we're always
adding to the existing object, which in the future _could_ make things
like OEM schemas or properties easier, as there's no case where we're
completely replacing the response object.

Tested:
Ran redfish service validator.  No new failures.

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Iae409b0a40ddd3ae6112cb2d52c6f6ab388595fe
diff --git a/redfish-core/lib/certificate_service.hpp b/redfish-core/lib/certificate_service.hpp
index 934f901..4ac3762 100644
--- a/redfish-core/lib/certificate_service.hpp
+++ b/redfish-core/lib/certificate_service.hpp
@@ -54,13 +54,15 @@
             {
                 return;
             }
-            asyncResp->res.jsonValue = {
-                {"@odata.type",
-                 "#CertificateService.v1_0_0.CertificateService"},
-                {"@odata.id", "/redfish/v1/CertificateService"},
-                {"Id", "CertificateService"},
-                {"Name", "Certificate Service"},
-                {"Description", "Actions available to manage certificates"}};
+
+            asyncResp->res.jsonValue["@odata.type"] =
+                "#CertificateService.v1_0_0.CertificateService";
+            asyncResp->res.jsonValue["@odata.id"] =
+                "/redfish/v1/CertificateService";
+            asyncResp->res.jsonValue["Id"] = "CertificateService";
+            asyncResp->res.jsonValue["Name"] = "Certificate Service";
+            asyncResp->res.jsonValue["Description"] =
+                "Actions available to manage certificates";
             // /redfish/v1/CertificateService/CertificateLocations is something
             // only ConfigureManager can access then only display when the user
             // has permissions ConfigureManager
@@ -69,9 +71,8 @@
             if (isOperationAllowedWithPrivileges({{"ConfigureManager"}},
                                                  effectiveUserPrivileges))
             {
-                asyncResp->res.jsonValue["CertificateLocations"] = {
-                    {"@odata.id",
-                     "/redfish/v1/CertificateService/CertificateLocations"}};
+                asyncResp->res.jsonValue["CertificateLocations"]["@odata.id"] =
+                    "/redfish/v1/CertificateService/CertificateLocations";
             }
             asyncResp->res
                 .jsonValue["Actions"]
@@ -234,8 +235,8 @@
                 return;
             }
             asyncResp->res.jsonValue["CSRString"] = csr;
-            asyncResp->res.jsonValue["CertificateCollection"] = {
-                {"@odata.id", certURI}};
+            asyncResp->res.jsonValue["CertificateCollection"]["@odata.id"] =
+                certURI;
         },
         service, csrObjPath, "xyz.openbmc_project.Certs.CSR", "CSR");
 }
@@ -592,12 +593,12 @@
                                            std::to_string(certId));
                 return;
             }
-            asyncResp->res.jsonValue = {
-                {"@odata.id", certURL},
-                {"@odata.type", "#Certificate.v1_0_0.Certificate"},
-                {"Id", std::to_string(certId)},
-                {"Name", name},
-                {"Description", name}};
+            asyncResp->res.jsonValue["@odata.id"] = certURL;
+            asyncResp->res.jsonValue["@odata.type"] =
+                "#Certificate.v1_0_0.Certificate";
+            asyncResp->res.jsonValue["Id"] = std::to_string(certId);
+            asyncResp->res.jsonValue["Name"] = name;
+            asyncResp->res.jsonValue["Description"] = name;
             for (const auto& property : properties)
             {
                 if (property.first == "CertificateString")
@@ -856,12 +857,14 @@
             {
                 return;
             }
-            asyncResp->res.jsonValue = {
-                {"@odata.id",
-                 "/redfish/v1/Managers/bmc/NetworkProtocol/HTTPS/Certificates"},
-                {"@odata.type", "#CertificateCollection.CertificateCollection"},
-                {"Name", "HTTPS Certificates Collection"},
-                {"Description", "A Collection of HTTPS certificate instances"}};
+
+            asyncResp->res.jsonValue["@odata.id"] =
+                "/redfish/v1/Managers/bmc/NetworkProtocol/HTTPS/Certificates";
+            asyncResp->res.jsonValue["@odata.type"] =
+                "#CertificateCollection.CertificateCollection";
+            asyncResp->res.jsonValue["Name"] = "HTTPS Certificates Collection";
+            asyncResp->res.jsonValue["Description"] =
+                "A Collection of HTTPS certificate instances";
 
             crow::connections::systemBus->async_method_call(
                 [asyncResp](const boost::system::error_code ec,
@@ -880,10 +883,11 @@
                         long id = getIDFromURL(cert.first.str);
                         if (id >= 0)
                         {
-                            members.push_back(
-                                {{"@odata.id",
-                                  "/redfish/v1/Managers/bmc/NetworkProtocol/HTTPS/Certificates/" +
-                                      std::to_string(id)}});
+                            nlohmann::json::object_t member;
+                            member["@odata.id"] =
+                                "/redfish/v1/Managers/bmc/NetworkProtocol/HTTPS/Certificates/" +
+                                std::to_string(id);
+                            members.push_back(std::move(member));
                         }
                     }
                     asyncResp->res.jsonValue["Members@odata.count"] =
@@ -907,8 +911,8 @@
             }
             BMCWEB_LOG_DEBUG << "HTTPSCertificateCollection::doPost";
 
-            asyncResp->res.jsonValue = {{"Name", "HTTPS Certificate"},
-                                        {"Description", "HTTPS Certificate"}};
+            asyncResp->res.jsonValue["Name"] = "HTTPS Certificate";
+            asyncResp->res.jsonValue["Description"] = "HTTPS Certificate";
 
             std::string certFileBody =
                 getCertificateFromReqBody(asyncResp, req);
@@ -987,8 +991,9 @@
                 long id = getIDFromURL(cert.first.str);
                 if (id >= 0)
                 {
-                    links.push_back(
-                        {{"@odata.id", certURL + std::to_string(id)}});
+                    nlohmann::json::object_t link;
+                    link["@odata.id"] = certURL + std::to_string(id);
+                    links.push_back(std::move(link));
                 }
             }
             asyncResp->res.jsonValue["Links"]["Certificates@odata.count"] =
@@ -1013,16 +1018,15 @@
             {
                 return;
             }
-            asyncResp->res.jsonValue = {
-                {"@odata.id",
-                 "/redfish/v1/CertificateService/CertificateLocations"},
-                {"@odata.type",
-                 "#CertificateLocations.v1_0_0.CertificateLocations"},
-                {"Name", "Certificate Locations"},
-                {"Id", "CertificateLocations"},
-                {"Description",
-                 "Defines a resource that an administrator can use in order to "
-                 "locate all certificates installed on a given service"}};
+            asyncResp->res.jsonValue["@odata.id"] =
+                "/redfish/v1/CertificateService/CertificateLocations";
+            asyncResp->res.jsonValue["@odata.type"] =
+                "#CertificateLocations.v1_0_0.CertificateLocations";
+            asyncResp->res.jsonValue["Name"] = "Certificate Locations";
+            asyncResp->res.jsonValue["Id"] = "CertificateLocations";
+            asyncResp->res.jsonValue["Description"] =
+                "Defines a resource that an administrator can use in order to "
+                "locate all certificates installed on a given service";
 
             nlohmann::json& links =
                 asyncResp->res.jsonValue["Links"]["Certificates"];
@@ -1056,11 +1060,14 @@
             {
                 return;
             }
-            asyncResp->res.jsonValue = {
-                {"@odata.id", "/redfish/v1/AccountService/LDAP/Certificates"},
-                {"@odata.type", "#CertificateCollection.CertificateCollection"},
-                {"Name", "LDAP Certificates Collection"},
-                {"Description", "A Collection of LDAP certificate instances"}};
+
+            asyncResp->res.jsonValue["@odata.id"] =
+                "/redfish/v1/AccountService/LDAP/Certificates";
+            asyncResp->res.jsonValue["@odata.type"] =
+                "#CertificateCollection.CertificateCollection";
+            asyncResp->res.jsonValue["Name"] = "LDAP Certificates Collection";
+            asyncResp->res.jsonValue["Description"] =
+                "A Collection of LDAP certificate instances";
 
             crow::connections::systemBus->async_method_call(
                 [asyncResp](const boost::system::error_code ec,
@@ -1082,10 +1089,11 @@
                         long id = getIDFromURL(cert.first.str);
                         if (id >= 0)
                         {
-                            members.push_back(
-                                {{"@odata.id",
-                                  "/redfish/v1/AccountService/LDAP/Certificates/" +
-                                      std::to_string(id)}});
+                            nlohmann::json::object_t member;
+                            member["@odata.id"] =
+                                "/redfish/v1/AccountService/LDAP/Certificates/" +
+                                std::to_string(id);
+                            members.push_back(std::move(member));
                         }
                     }
                     count = members.size();
@@ -1200,13 +1208,15 @@
             {
                 return;
             }
-            asyncResp->res.jsonValue = {
-                {"@odata.id",
-                 "/redfish/v1/Managers/bmc/Truststore/Certificates/"},
-                {"@odata.type", "#CertificateCollection.CertificateCollection"},
-                {"Name", "TrustStore Certificates Collection"},
-                {"Description",
-                 "A Collection of TrustStore certificate instances"}};
+
+            asyncResp->res.jsonValue["@odata.id"] =
+                "/redfish/v1/Managers/bmc/Truststore/Certificates/";
+            asyncResp->res.jsonValue["@odata.type"] =
+                "#CertificateCollection.CertificateCollection";
+            asyncResp->res.jsonValue["Name"] =
+                "TrustStore Certificates Collection";
+            asyncResp->res.jsonValue["Description"] =
+                "A Collection of TrustStore certificate instances";
 
             crow::connections::systemBus->async_method_call(
                 [asyncResp](const boost::system::error_code ec,
@@ -1225,10 +1235,11 @@
                         long id = getIDFromURL(cert.first.str);
                         if (id >= 0)
                         {
-                            members.push_back(
-                                {{"@odata.id",
-                                  "/redfish/v1/Managers/bmc/Truststore/Certificates/" +
-                                      std::to_string(id)}});
+                            nlohmann::json::object_t member;
+                            member["@odata.id"] =
+                                "/redfish/v1/Managers/bmc/Truststore/Certificates/" +
+                                std::to_string(id);
+                            members.push_back(std::move(member));
                         }
                     }
                     asyncResp->res.jsonValue["Members@odata.count"] =