MCPcopy Create free account
hub / github.com/Barracuda09/SATPI / makeJSONString

Method makeJSONString

src/base/JSONSerializer.h:109–123  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

107 }
108
109 std::string makeJSONString(const std::string &msg) {
110 std::string json(msg);
111 std::string::iterator it = json.begin();
112 while (it != json.end()) {
113 if (*it == '"' || *it == '\\' || *it == '/' || *it == '\b' ||
114 *it == '\f' || *it == '\n' || *it == '\r' || *it == '\t') {
115 it = json.insert(it, '\\');
116 if (it != json.end()) {
117 ++it;
118 }
119 }
120 ++it;
121 }
122 return json;
123 }
124
125 // =======================================================================
126 // -- Data members -------------------------------------------------------

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected