aboutsummaryrefslogtreecommitdiff
path: root/src/test/util/json.cpp
diff options
context:
space:
mode:
authorHennadii Stepanov <32963518+hebasto@users.noreply.github.com>2023-01-27 09:26:29 +0000
committerHennadii Stepanov <32963518+hebasto@users.noreply.github.com>2023-01-27 09:26:29 +0000
commit7a820cee0e6408f5848799011d82dd29ee7fa8c5 (patch)
treea840e2cbc6c62ffd43e7a51e99b2163c31cd6425 /src/test/util/json.cpp
parent835212cd1d8f8fc7f19775f5ff8cc21c099122b2 (diff)
test, build: Separate `read_json` function into its own module
Diffstat (limited to 'src/test/util/json.cpp')
-rw-r--r--src/test/util/json.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/test/util/json.cpp b/src/test/util/json.cpp
new file mode 100644
index 0000000000..ad3c346c84
--- /dev/null
+++ b/src/test/util/json.cpp
@@ -0,0 +1,17 @@
+// Copyright (c) 2023 The Bitcoin Core developers
+// Distributed under the MIT software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
+#include <test/util/json.h>
+
+#include <string>
+#include <util/check.h>
+
+#include <univalue.h>
+
+UniValue read_json(const std::string& jsondata)
+{
+ UniValue v;
+ Assert(v.read(jsondata) && v.isArray());
+ return v.get_array();
+}