diff options
author | Jeff Hatch <jhatch@multitech.com> | 2021-03-11 08:21:22 -0600 |
---|---|---|
committer | Jeff Hatch <jhatch@multitech.com> | 2021-03-11 08:21:22 -0600 |
commit | 962c6d0f5ce2579a6f3beeaa611659daeb4c2d44 (patch) | |
tree | 9d9ce237e4be9205f8e2450d4e57c4897991b57d | |
parent | b171f5cb629c3123ec1adc0300ad63d297a77c25 (diff) | |
download | jsparser-master.tar.gz jsparser-master.tar.bz2 jsparser-master.zip |
-rw-r--r-- | main.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -57,9 +57,17 @@ std::string handleIsOptions(const Json::Value& data); int main(int argc, char** argv) { Json::Value jInput; - std::string sInput; std::string sPath(parseOptions(argc, argv)); +#if defined(JSONCPP_VERSION_HEXA) && (JSONCPP_VERSION_HEXA > 0x010600) // > 1.6.0 + Json::CharReaderBuilder builder; + builder.strictMode(&builder.settings_); + if (!Json::parseFromStream(builder, std::cin, &jInput, NULL)) { + fprintf(stderr, "bad json input\n"); + return 1; + } +#else + std::string sInput; std::stringstream ss; std::string line; while (std::getline(std::cin, line)) { @@ -77,7 +85,7 @@ int main(int argc, char** argv) { fprintf(stderr, "bad json input\n"); return 1; } - +#endif printf("%s", get(sPath, jInput).c_str()); return 0; |