rippled
Loading...
Searching...
No Matches
jtx_json.cpp
1#include <test/jtx/jtx_json.h>
2#include <test/jtx/utility.h>
3
4#include <xrpl/basics/contract.h>
5#include <xrpl/json/json_reader.h>
6
7namespace ripple {
8namespace test {
9namespace jtx {
10
12{
13 if (!Json::Reader().parse(s, jv_))
14 Throw<parse_error>("bad json");
15}
16
17json::json(char const* s) : json(std::string(s))
18{
19}
20
21json::json(Json::Value jv) : jv_(std::move(jv))
22{
23}
24
25void
27{
28 auto& jv = jt.jv;
29 for (auto iter = jv_.begin(); iter != jv_.end(); ++iter)
30 jv[iter.key().asString()] = *iter;
31}
32
33} // namespace jtx
34} // namespace test
35} // namespace ripple
Unserialize a JSON document into a Value.
Definition json_reader.h:20
Represents a JSON value.
Definition json_value.h:130
const_iterator begin() const
const_iterator end() const
A transaction testing environment.
Definition Env.h:102
Inject raw JSON.
Definition jtx_json.h:14
json(std::string const &)
Definition jtx_json.cpp:11
void operator()(Env &, JTx &jt) const
Definition jtx_json.cpp:26
STObject parse(Json::Value const &jv)
Convert JSON to STObject.
Definition utility.cpp:19
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:6
STL namespace.
Execution context for applying a JSON transaction.
Definition JTx.h:26
Json::Value jv
Definition JTx.h:27