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/update_service.hpp b/redfish-core/lib/update_service.hpp
index 70fe8db..b5108ae 100644
--- a/redfish-core/lib/update_service.hpp
+++ b/redfish-core/lib/update_service.hpp
@@ -560,8 +560,8 @@
                 "/redfish/v1/UpdateService";
             // UpdateService cannot be disabled
             asyncResp->res.jsonValue["ServiceEnabled"] = true;
-            asyncResp->res.jsonValue["FirmwareInventory"] = {
-                {"@odata.id", "/redfish/v1/UpdateService/FirmwareInventory"}};
+            asyncResp->res.jsonValue["FirmwareInventory"]["@odata.id"] =
+                "/redfish/v1/UpdateService/FirmwareInventory";
             // Get the MaxImageSizeBytes
             asyncResp->res.jsonValue["MaxImageSizeBytes"] =
                 bmcwebHttpReqBodyLimitMb * 1024 * 1024;
@@ -725,66 +725,67 @@
 {
     BMCWEB_ROUTE(app, "/redfish/v1/UpdateService/FirmwareInventory/")
         .privileges(redfish::privileges::getSoftwareInventoryCollection)
-        .methods(boost::beast::http::verb::get)([&app](const crow::Request& req,
-                                                       const std::shared_ptr<
-                                                           bmcweb::AsyncResp>&
-                                                           asyncResp) {
-            if (!redfish::setUpRedfishRoute(app, req, asyncResp->res))
-            {
-                return;
-            }
-            asyncResp->res.jsonValue["@odata.type"] =
-                "#SoftwareInventoryCollection.SoftwareInventoryCollection";
-            asyncResp->res.jsonValue["@odata.id"] =
-                "/redfish/v1/UpdateService/FirmwareInventory";
-            asyncResp->res.jsonValue["Name"] = "Software Inventory Collection";
+        .methods(boost::beast::http::verb::get)(
+            [&app](const crow::Request& req,
+                   const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
+                if (!redfish::setUpRedfishRoute(app, req, asyncResp->res))
+                {
+                    return;
+                }
+                asyncResp->res.jsonValue["@odata.type"] =
+                    "#SoftwareInventoryCollection.SoftwareInventoryCollection";
+                asyncResp->res.jsonValue["@odata.id"] =
+                    "/redfish/v1/UpdateService/FirmwareInventory";
+                asyncResp->res.jsonValue["Name"] =
+                    "Software Inventory Collection";
 
-            crow::connections::systemBus->async_method_call(
-                [asyncResp](
-                    const boost::system::error_code ec,
-                    const dbus::utility::MapperGetSubTreeResponse& subtree) {
-                    if (ec)
-                    {
-                        messages::internalError(asyncResp->res);
-                        return;
-                    }
-                    asyncResp->res.jsonValue["Members"] =
-                        nlohmann::json::array();
-                    asyncResp->res.jsonValue["Members@odata.count"] = 0;
-
-                    for (const auto& obj : subtree)
-                    {
-                        sdbusplus::message::object_path path(obj.first);
-                        std::string swId = path.filename();
-                        if (swId.empty())
+                crow::connections::systemBus->async_method_call(
+                    [asyncResp](const boost::system::error_code ec,
+                                const dbus::utility::MapperGetSubTreeResponse&
+                                    subtree) {
+                        if (ec)
                         {
                             messages::internalError(asyncResp->res);
-                            BMCWEB_LOG_DEBUG << "Can't parse firmware ID!!";
                             return;
                         }
+                        asyncResp->res.jsonValue["Members"] =
+                            nlohmann::json::array();
+                        asyncResp->res.jsonValue["Members@odata.count"] = 0;
 
-                        nlohmann::json& members =
-                            asyncResp->res.jsonValue["Members"];
-                        members.push_back(
-                            {{"@odata.id",
-                              "/redfish/v1/UpdateService/FirmwareInventory/" +
-                                  swId}});
-                        asyncResp->res.jsonValue["Members@odata.count"] =
-                            members.size();
-                    }
-                },
-                // Note that only firmware levels associated with a device
-                // are stored under /xyz/openbmc_project/software therefore
-                // to ensure only real FirmwareInventory items are returned,
-                // this full object path must be used here as input to
-                // mapper
-                "xyz.openbmc_project.ObjectMapper",
-                "/xyz/openbmc_project/object_mapper",
-                "xyz.openbmc_project.ObjectMapper", "GetSubTree",
-                "/xyz/openbmc_project/software", static_cast<int32_t>(0),
-                std::array<const char*, 1>{
-                    "xyz.openbmc_project.Software.Version"});
-        });
+                        for (const auto& obj : subtree)
+                        {
+                            sdbusplus::message::object_path path(obj.first);
+                            std::string swId = path.filename();
+                            if (swId.empty())
+                            {
+                                messages::internalError(asyncResp->res);
+                                BMCWEB_LOG_DEBUG << "Can't parse firmware ID!!";
+                                return;
+                            }
+
+                            nlohmann::json& members =
+                                asyncResp->res.jsonValue["Members"];
+                            nlohmann::json::object_t member;
+                            member["@odata.id"] =
+                                "/redfish/v1/UpdateService/FirmwareInventory/" +
+                                swId;
+                            members.push_back(std::move(member));
+                            asyncResp->res.jsonValue["Members@odata.count"] =
+                                members.size();
+                        }
+                    },
+                    // Note that only firmware levels associated with a device
+                    // are stored under /xyz/openbmc_project/software therefore
+                    // to ensure only real FirmwareInventory items are returned,
+                    // this full object path must be used here as input to
+                    // mapper
+                    "xyz.openbmc_project.ObjectMapper",
+                    "/xyz/openbmc_project/object_mapper",
+                    "xyz.openbmc_project.ObjectMapper", "GetSubTree",
+                    "/xyz/openbmc_project/software", static_cast<int32_t>(0),
+                    std::array<const char*, 1>{
+                        "xyz.openbmc_project.Software.Version"});
+            });
 }
 /* Fill related item links (i.e. bmc, bios) in for inventory */
 inline static void
@@ -794,14 +795,17 @@
     if (purpose == fw_util::bmcPurpose)
     {
         nlohmann::json& relatedItem = aResp->res.jsonValue["RelatedItem"];
-        relatedItem.push_back({{"@odata.id", "/redfish/v1/Managers/bmc"}});
+        nlohmann::json::object_t item;
+        item["@odata.id"] = "/redfish/v1/Managers/bmc";
+        relatedItem.push_back(std::move(item));
         aResp->res.jsonValue["RelatedItem@odata.count"] = relatedItem.size();
     }
     else if (purpose == fw_util::biosPurpose)
     {
         nlohmann::json& relatedItem = aResp->res.jsonValue["RelatedItem"];
-        relatedItem.push_back(
-            {{"@odata.id", "/redfish/v1/Systems/system/Bios"}});
+        nlohmann::json::object_t item;
+        item["@odata.id"] = "/redfish/v1/Systems/system/Bios";
+        relatedItem.push_back(std::move(item));
         aResp->res.jsonValue["RelatedItem@odata.count"] = relatedItem.size();
     }
     else