mirror of
https://github.com/g4klx/MMDVMHost
synced 2025-12-22 08:05:49 +08:00
Fix the top level JSON category.
This commit is contained in:
11
Log.cpp
11
Log.cpp
@@ -200,9 +200,14 @@ void Log(unsigned int level, const char* fmt, ...)
|
||||
}
|
||||
}
|
||||
|
||||
void WriteJSON(const std::string& json)
|
||||
void WriteJSON(const std::string& topLevel, nlohmann::json& json)
|
||||
{
|
||||
if (m_mqtt != NULL)
|
||||
m_mqtt->publish("json", json.c_str());
|
||||
if (m_mqtt != NULL) {
|
||||
nlohmann::json top;
|
||||
|
||||
top[topLevel] = json;
|
||||
|
||||
m_mqtt->publish("json", top.dump().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user