Remove nlohmann brace initialization

There's a few last places (outside of tests) where we still use
nlohmann brace initialization.  Per the transforms we've been doing,
move these to constructing the objects explicitly, using operator[],
nlohmann::object_t and nlohmann::array_t.  Theses were found by manual
inspection grepping for all uses of nlohmann::json.

This is done to reduce binary size and reduce the number of intermediate
objects being constructed.  This commit saves a trivial amount of size
(~4KB, Half a percent of total) and in addition but makes our
construction consistent.

Tested:
Redfish service validator passes.

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I7478479a9fdc41b254eef325002d413c1fb411a0
diff --git a/redfish-core/lib/message_registries.hpp b/redfish-core/lib/message_registries.hpp
index 09d32b7..9d6f109 100644
--- a/redfish-core/lib/message_registries.hpp
+++ b/redfish-core/lib/message_registries.hpp
@@ -25,6 +25,8 @@
 #include <query.hpp>
 #include <registries/privilege_registry.hpp>
 
+#include <array>
+
 namespace redfish
 {
 
@@ -46,11 +48,16 @@
     asyncResp->res.jsonValue["Description"] =
         "Collection of MessageRegistryFiles";
     asyncResp->res.jsonValue["Members@odata.count"] = 4;
-    asyncResp->res.jsonValue["Members"] = {
-        {{"@odata.id", "/redfish/v1/Registries/Base"}},
-        {{"@odata.id", "/redfish/v1/Registries/TaskEvent"}},
-        {{"@odata.id", "/redfish/v1/Registries/ResourceEvent"}},
-        {{"@odata.id", "/redfish/v1/Registries/OpenBMC"}}};
+
+    nlohmann::json& members = asyncResp->res.jsonValue["Members"];
+    for (const char* memberName :
+         std::to_array({"Base", "TaskEvent", "ResourceEvent", "OpenBMC"}))
+    {
+        nlohmann::json::object_t member;
+        member["@odata.id"] = crow::utility::urlFromPieces(
+            "redfish", "v1", "Registries", memberName);
+        members.emplace_back(std::move(member));
+    }
 }
 
 inline void requestRoutesMessageRegistryFileCollection(App& app)
@@ -113,18 +120,22 @@
         dmtf + registry + " Message Registry File Location";
     asyncResp->res.jsonValue["Id"] = header->registryPrefix;
     asyncResp->res.jsonValue["Registry"] = header->id;
-    asyncResp->res.jsonValue["Languages"] = {"en"};
-    asyncResp->res.jsonValue["Languages@odata.count"] = 1;
-    asyncResp->res.jsonValue["Location"] = {
-        {{"Language", "en"},
-         {"Uri", "/redfish/v1/Registries/" + registry + "/" + registry}}};
-
-    asyncResp->res.jsonValue["Location@odata.count"] = 1;
+    nlohmann::json::array_t languages;
+    languages.push_back("en");
+    asyncResp->res.jsonValue["Languages@odata.count"] = languages.size();
+    asyncResp->res.jsonValue["Languages"] = std::move(languages);
+    nlohmann::json::array_t locationMembers;
+    nlohmann::json::object_t location;
+    location["Language"] = "en";
+    location["Uri"] = "/redfish/v1/Registries/" + registry + "/" + registry;
 
     if (url != nullptr)
     {
-        asyncResp->res.jsonValue["Location"][0]["PublicationUri"] = url;
+        location["PublicationUri"] = url;
     }
+    locationMembers.emplace_back(std::move(location));
+    asyncResp->res.jsonValue["Location@odata.count"] = locationMembers.size();
+    asyncResp->res.jsonValue["Location"] = std::move(locationMembers);
 }
 
 inline void requestRoutesMessageRegistryFile(App& app)