// Test program that can be called by the JSON test suite at // https://github.com/nst/JSONTestSuite. // // It reads JSON input from stdin and exits with code 0 if it can be parsed // successfully. It also pretty prints the parsed JSON value to stdout. #include #include #include "univalue.h" using namespace std; int main (int argc, char *argv[]) { UniValue val; if (val.read(string(istreambuf_iterator(cin), istreambuf_iterator()))) { cout << val.write(1 /* prettyIndent */, 4 /* indentLevel */) << endl; return 0; } else { cerr << "JSON Parse Error." << endl; return 1; } }