diff --git a/src/nhttpd/yhttpd_core/yhook.cpp b/src/nhttpd/yhttpd_core/yhook.cpp index b34bce2f7..e9b9425ac 100644 --- a/src/nhttpd/yhttpd_core/yhook.cpp +++ b/src/nhttpd/yhttpd_core/yhook.cpp @@ -452,7 +452,7 @@ std::string CyhookHandler::outPair(std::string _key, std::string _content, bool } //----------------------------------------------------------------------------- -std::string CyhookHandler::outArray(std::string _key, std::string _content) { +std::string CyhookHandler::outArray(std::string _key, std::string _content, bool _next) { std::string result = ""; switch (outType) { case xml: @@ -463,6 +463,8 @@ std::string CyhookHandler::outArray(std::string _key, std::string _content) { case json: //TODO: json check result = outIndent() + "\"" + _key + "\": [" + _content + "]"; + if(_next) + result += ","; result += "\n"; break; default: diff --git a/src/nhttpd/yhttpd_core/yhook.h b/src/nhttpd/yhttpd_core/yhook.h index 9f8e2e332..30bf18949 100644 --- a/src/nhttpd/yhttpd_core/yhook.h +++ b/src/nhttpd/yhttpd_core/yhook.h @@ -206,7 +206,7 @@ public: std::string outIndent(); std::string outSingle(std::string _content); std::string outPair(std::string _key, std::string _content, bool _next); - std::string outArray(std::string _key, std::string _content); + std::string outArray(std::string _key, std::string _content, bool _next = false); std::string outArrayItem(std::string _key, std::string _content, bool _next); std::string outObject(std::string _key,std::string _content, bool _next = false); std::string outValue(std::string _content);