-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJSON.cpp
More file actions
33 lines (23 loc) · 644 Bytes
/
JSON.cpp
File metadata and controls
33 lines (23 loc) · 644 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
//
// Created by Sierra Kilo on 26-Feb-19.
//
#include "JSON.h"
nlohmann::json JSON::prepareJsonReply(std::string status, std::map<std::string, std::string> data) {
nlohmann::json json_msg;
json_msg = {
{"status", status},
{"data", data}
};
return json_msg;
}
nlohmann::json JSON::prepareJsonRequest(std::string request, std::map<std::string, std::string> data) {
nlohmann::json json_msg;
json_msg = {
{"request", request},
{"data", data}
};
return json_msg;
}
std::string JSON::convertJsonToString(nlohmann::json jsonObj) {
return jsonObj.dump(4);
}