FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

GitHub Viewer

#include "cppjson.hpp" #include #include #include #include std::string toString(const JSON &json); std::string escapeCharacters(const std::string &str); std::string toStringArray(const JSON &json); std::string toString(const JSON &json) { switch (json.type()) { case JSON::Bool: return json.getBool() ? "true" : "false"; case JSON::String: return escapeCharacters(json.getString()); case JSON::Null: return "null"; case JSON::Number: { double val = json.getNumber(); if (std::isnan(val) || std::isinf(val)) { return "null"; } else { std::ostringstream oss; oss first); s += "\":\""; s+= toString(it->second); s += '"'; if (it != std::prev(object.end())) s += ','; } s += '}'; return s; } default: return ""; } } std::string escapeCharacters(const std::string &str) { std::ostringstream oss; for (auto it = str.cbegin(); it != str.cend(); it++) { switch (*it) { case '\n': oss

Back | FazBrowse Home | New Git URL