diff --git a/support/3rd_party/include/utils/file.hpp b/support/3rd_party/include/utils/file.hpp index 541cba16..6513d41e 100644 --- a/support/3rd_party/include/utils/file.hpp +++ b/support/3rd_party/include/utils/file.hpp @@ -77,8 +77,9 @@ public: #if defined(PROJECT_ENABLE_JSON) [[nodiscard]] auto write(const nlohmann::json &data, std::uint64_t offset, std::size_t *total_written = nullptr) -> bool { - return write_(reinterpret_cast(data.dump().c_str()), - offset, total_written); + auto str_data = data.dump(); + return write_(reinterpret_cast(str_data.c_str()), + data.size(), offset, total_written); } #endif // defined(PROJECT_ENABLE_JSON)