json: format output with 4-space indentation
Use `dump(4)` instead of `dump()` to generate JSON with
4-space indentation, improving readability of written files.
Change-Id: Ib0a0e932bba76091dbb6a6b89640e579df289747
Signed-off-by: George Liu <liuxiwei@ieisystem.com>
diff --git a/oem/nvidia/biosconfigcommands.cpp b/oem/nvidia/biosconfigcommands.cpp
index 6952d85..cce5b0c 100644
--- a/oem/nvidia/biosconfigcommands.cpp
+++ b/oem/nvidia/biosconfigcommands.cpp
@@ -92,7 +92,7 @@
try
{
std::ofstream ofs(biosPasswordFilePath, std::ios::out);
- const auto& writeData = json.dump();
+ const auto& writeData = json.dump(4);
ofs << writeData;
ofs.close();
}
diff --git a/user_channel/channel_mgmt.cpp b/user_channel/channel_mgmt.cpp
index d4757df..77297c4 100644
--- a/user_channel/channel_mgmt.cpp
+++ b/user_channel/channel_mgmt.cpp
@@ -844,7 +844,7 @@
tmpFile);
return -EIO;
}
- const auto& writeData = jsonData.dump();
+ const auto& writeData = jsonData.dump(4);
if (write(fd, writeData.c_str(), writeData.size()) !=
static_cast<ssize_t>(writeData.size()))
{
diff --git a/user_channel/cipher_mgmt.cpp b/user_channel/cipher_mgmt.cpp
index c0c0ae1..01518c6 100644
--- a/user_channel/cipher_mgmt.cpp
+++ b/user_channel/cipher_mgmt.cpp
@@ -133,7 +133,7 @@
"FILE_NAME", tmpFile);
return -EIO;
}
- const auto& writeData = jsonData.dump();
+ const auto& writeData = jsonData.dump(4);
if (write(fd, writeData.c_str(), writeData.size()) !=
static_cast<ssize_t>(writeData.size()))
{
diff --git a/user_channel/user_mgmt.cpp b/user_channel/user_mgmt.cpp
index e51e4e5..92b9659 100644
--- a/user_channel/user_mgmt.cpp
+++ b/user_channel/user_mgmt.cpp
@@ -1291,7 +1291,7 @@
throw std::ios_base::failure(
"Error in creating temporary IPMI user data file");
}
- const auto& writeStr = jsonUsersTbl.dump();
+ const auto& writeStr = jsonUsersTbl.dump(4);
if (write(fd, writeStr.c_str(), writeStr.size()) !=
static_cast<ssize_t>(writeStr.size()))
{