summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/main.cpp b/main.cpp
index 761b507..76a5836 100644
--- a/main.cpp
+++ b/main.cpp
@@ -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;