Github user phrocker commented on a diff in the pull request: https://github.com/apache/nifi-minifi-cpp/pull/191#discussion_r151566381 --- Diff: extensions/http-curl/protocols/RESTProtocol.cpp --- @@ -81,48 +93,117 @@ const C2Payload RESTProtocol::parseJsonResponse(const C2Payload &payload, const return std::move(C2Payload(payload.getOperation(), state::UpdateState::READ_ERROR, true)); } -Json::Value RESTProtocol::serializeJsonPayload(Json::Value &json_root, const C2Payload &payload) { - // get the name from the content - Json::Value json_payload; - std::map<std::string, std::vector<Json::Value>> children; - for (const auto &nested_payload : payload.getNestedPayloads()) { - Json::Value child_payload = serializeJsonPayload(json_payload, nested_payload); - children[nested_payload.getLabel()].push_back(child_payload); - } - for (auto child_vector : children) { - if (child_vector.second.size() > 1) { - Json::Value children_json(Json::arrayValue); - for (auto child : child_vector.second) { - json_payload[child_vector.first] = child; - } - } else { - if (child_vector.second.size() == 1) { - if (child_vector.second.at(0).isMember(child_vector.first)) { - json_payload[child_vector.first] = child_vector.second.at(0)[child_vector.first]; - } else { - json_payload[child_vector.first] = child_vector.second.at(0); - } - } - } - } +void setJsonStr(const std::string& key, const std::string& value, rapidjson::Value& parent, rapidjson::Document::AllocatorType& alloc) { // NOLINT --- End diff -- why is there no linter here? We want this linted.
---