Bitcoin Core
28.0.0
P2P Digital Currency
Loading...
Searching...
No Matches
src
univalue
test
test_json.cpp
Go to the documentation of this file.
1
// Test program that can be called by the JSON test suite at
2
// https://github.com/nst/JSONTestSuite.
3
//
4
// It reads JSON input from stdin and exits with code 0 if it can be parsed
5
// successfully. It also pretty prints the parsed JSON value to stdout.
6
7
#include <
univalue.h
>
8
9
#include <iostream>
10
#include <iterator>
11
#include <string>
12
13
using namespace
std
;
14
15
int
main
(
int
argc,
char
*argv[])
16
{
17
UniValue
val;
18
if
(val.
read
(
string
(istreambuf_iterator<char>(cin),
19
istreambuf_iterator<char>()))) {
20
cout << val.
write
(1
/* prettyIndent */
, 4
/* indentLevel */
) << endl;
21
return
0;
22
}
else
{
23
cerr <<
"JSON Parse Error."
<< endl;
24
return
1;
25
}
26
}
UniValue
Definition
univalue.h:22
UniValue::write
std::string write(unsigned int prettyIndent=0, unsigned int indentLevel=0) const
Definition
univalue_write.cpp:31
UniValue::read
bool read(std::string_view raw)
Definition
univalue_read.cpp:263
main
int main(void)
Definition
bench.c:156
std
Definition
setup_common.h:42
univalue.h
Generated on Thu Oct 3 2024 09:20:15 for Bitcoin Core by
1.12.0