mirror of
https://github.com/g4klx/MMDVMHost.git
synced 2026-04-06 15:04:18 +00:00
Fix the top level JSON category.
This commit is contained in:
parent
38a6dbbdeb
commit
2090432a6a
4 changed files with 53 additions and 43 deletions
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());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue