Closed vinniefalco closed 3 years ago
I see that this project is using nlohmann. Did you know that Boost.JSON has been accepted into Boost and will be in the next release? (it is already available as a repository with no dependencies). It offers a modern interface, security-awareness (hash tables are salted to prevent algorithmic complexity attacks), and memory controls over the streaming parser. It is also many times faster. Please check it out! https://github.com/boostorg/json
Hello Vinnie, yes I know about the addition of boost.json, I looked at the examples a bit and I wondered why high level operations, such as parsing and data manipulation were not provided in standalone (as a possibility)
ref: proxy, parse_file example.
How are handled optional json value, different json schema etc...
For example in our code base we enjoy:
void
from_json(const nlohmann::json& j, coin_config& cfg)
{
spdlog::debug("{} l{} f[{}]", __FUNCTION__, __LINE__, fs::path(__FILE__).filename().string());
j.at("coin").get_to(cfg.ticker);
j.at("name").get_to(cfg.name);
j.at("type").get_to(cfg.type); //< sugar syntax to field a c++ field
if (j.contains("mm2_backup")) { //< check if the field exist
cfg.custom_backup = j.at("mm2_backup"); //< fill the optional value
}
}
Also with nlohmann
the sugar parsing is recursive and native containers are handled such as
vector<string>, list<string>, map<string, string>
and once you have declared your'e from_json(custom_object)
and to_json(custom_object
immediatly vector<custom_object>
is supported.
How all this sugar approach work in boost.json
?
I think it's possible to use [ ]
too.
For example in our code base we enjoy:
One way to write equivalent code using Boost.JSON would be the following:
template<class T>
void extract( object const& obj, T& t, string_view key )
{
t = value_to<T>( obj.at( key ) );
}
template<class T>
void maybe_extract( object const& obj, T& t, string_view key )
{
object::const_iterator it = obj.find( key ); // <-- Only search for key once
if( it != obj.end() )
t = value_to<T>( it->value() );
}
coin_config
tag_invoke(
value_to_tag<coin_config> const&,
value const& jv)
{
coin_config result;
object const& obj = jv.as_object(); // <-- Only validate the kind==object once
extract( obj, result.ticker, "coin" );
extract( obj, result.name, "name" );
extract( obj, result.type, "type" );
maybe_extract( obj, result.custom_backup, "mm2_backup" );
return result;
}
Note that the nlohmann example you gave has several ineffiencies: It validates that the container holds an object four times, and it searches for the "mm2_backup" key twice. The Boost.JSON version above only validates once and searches once.
Boost.JSON also handles native containers and recursive type conversion (e.g. vector<T>
where T
is convertible).
How all this sugar approach work in boost.json ?
Boost.JSON uses "tag_invoke", which avoids the problem of argument dependent lookup. It is described in this paper: http://open-std.org/JTC1/SC22/WG21/docs/papers/2019/p1895r0.pdf
Boost.JSON provides far less sugar, but it also gives you exactly the tools that you need to write very efficient code which is concise, easy to read, and less likely to cause mistakes.
Ok i will tag that as a long term transition since it's require lot of works/refactoring
my estimation for a background tasks like that can take few month if we add unit tests at the same time, and require lot of testing from QA team too.
ref for the transition:
./atomicdex/config/wallet.cfg.cpp:21:#include <nlohmann/json.hpp>
./atomicdex/config/wallet.cfg.cpp:29: from_json(const nlohmann::json& j, wallet_cfg& cfg)
./atomicdex/config/wallet.cfg.cpp:59: to_json(nlohmann::json& j, const contact_contents& cfg)
./atomicdex/config/wallet.cfg.cpp:66: to_json(nlohmann::json& j, const contact& cfg)
./atomicdex/config/wallet.cfg.cpp:73: to_json(nlohmann::json& j, const wallet_cfg& cfg)
./atomicdex/config/wallet.cfg.cpp:82: to_json(nlohmann::json& j, const transactions_contents& cfg)
./atomicdex/config/wallet.cfg.cpp:89: from_json(const nlohmann::json& j, transactions_contents& cfg)
./atomicdex/config/coins.cfg.cpp:21:#include <nlohmann/json.hpp>
./atomicdex/config/coins.cfg.cpp:29: to_json(nlohmann::json& j, const electrum_server& cfg)
./atomicdex/config/coins.cfg.cpp:44: from_json(const nlohmann::json& j, electrum_server& cfg)
./atomicdex/config/coins.cfg.cpp:59: from_json(const nlohmann::json& j, coin_config& cfg)
./atomicdex/config/mm2.cfg.hpp:24: using nlohmann::json;
./atomicdex/config/app.cfg.hpp:20:#include <nlohmann/json_fwd.hpp>
./atomicdex/config/app.cfg.hpp:38: void from_json(const nlohmann::json& j, cfg& config);
./atomicdex/config/raw.mm2.coins.cfg.hpp:8:#include <nlohmann/json.hpp>
./atomicdex/config/raw.mm2.coins.cfg.hpp:13:namespace nlohmann
./atomicdex/config/raw.mm2.coins.cfg.hpp:33:} // namespace nlohmann
./atomicdex/config/raw.mm2.coins.cfg.hpp:38: using nlohmann::json;
./atomicdex/config/raw.mm2.coins.cfg.hpp:220: nlohmann::json j;
./atomicdex/config/app.cfg.cpp:25:#include <nlohmann/json.hpp>
./atomicdex/config/app.cfg.cpp:38: nlohmann::json config_json_data;
./atomicdex/config/app.cfg.cpp:63: from_json(const nlohmann::json& j, atomic_dex::cfg& config)
./atomicdex/config/app.cfg.cpp:103: nlohmann::json config_json_data;
./atomicdex/config/wallet.cfg.hpp:20:#include <nlohmann/json_fwd.hpp>
./atomicdex/config/wallet.cfg.hpp:31: void to_json(nlohmann::json& j, const contact_contents& cfg);
./atomicdex/config/wallet.cfg.hpp:39: void to_json(nlohmann::json& j, const contact& cfg);
./atomicdex/config/wallet.cfg.hpp:47: void to_json(nlohmann::json& j, const transactions_contents& cfg);
./atomicdex/config/wallet.cfg.hpp:48: void from_json(const nlohmann::json& j, transactions_contents& cfg);
./atomicdex/config/wallet.cfg.hpp:59: void from_json(const nlohmann::json& j, wallet_cfg& cfg);
./atomicdex/config/wallet.cfg.hpp:60: void to_json(nlohmann::json& j, const wallet_cfg& cfg);
./atomicdex/config/coins.cfg.hpp:23:#include <nlohmann/json.hpp>
./atomicdex/config/coins.cfg.hpp:34: void to_json(nlohmann::json& j, const electrum_server& cfg);
./atomicdex/config/coins.cfg.hpp:35: void from_json(const nlohmann::json& j, electrum_server& cfg);
./atomicdex/config/coins.cfg.hpp:59: std::optional<nlohmann::json> custom_backup;
./atomicdex/config/coins.cfg.hpp:62: void from_json(const nlohmann::json& j, coin_config& cfg);
./atomicdex/managers/qt.wallet.manager.cpp:99: nlohmann::json wallet_object_json;
./atomicdex/managers/qt.wallet.manager.cpp:188: nlohmann::json j;
./atomicdex/managers/qt.wallet.manager.cpp:211: nlohmann::json j;
./atomicdex/tests/atomic.dex.wallet.config.tests.cpp:22:#include <nlohmann/json.hpp>
./atomicdex/tests/atomic.dex.wallet.config.tests.cpp:157: nlohmann::json out_json;
./atomicdex/models/qt.portfolio.model.cpp:94: .trend_7d = nlohmann_json_array_to_qt_json_array(paprika.get_ticker_historical(coin.ticker).answer),
./atomicdex/models/qt.portfolio.model.cpp:339: item.multi_ticker_data = nlohmann_json_object_to_qt_json_object(nlohmann::json::parse(value.toString().toStdString()));
./atomicdex/models/qt.contact.model.cpp:125: nlohmann::json j{{"type", cur.type.toStdString()}, {"address", cur.address.toStdString()}};
./atomicdex/models/qt.candlestick.charts.model.cpp:358: auto from_it = std::lower_bound(begin(m_model_data), end(m_model_data), from_timestamp, [](const nlohmann::json& current_json, int timestamp) {
./atomicdex/models/qt.candlestick.charts.model.cpp:363: auto to_it = std::lower_bound(begin(m_model_data), end(m_model_data), to_timestamp, [](const nlohmann::json& current_json, int timestamp) {
./atomicdex/models/qt.candlestick.charts.model.cpp:370: auto min_value_j = std::min_element(from_it, to_it, [](nlohmann::json& left, nlohmann::json& right) {
./atomicdex/models/qt.candlestick.charts.model.cpp:376: auto max_value_j = std::max_element(from_it, to_it, [](nlohmann::json& left, nlohmann::json& right) {
./atomicdex/models/qt.candlestick.charts.model.cpp:382: auto max_volume_j = std::max_element(from_it, to_it, [](nlohmann::json& left, nlohmann::json& right) {
./atomicdex/models/qt.candlestick.charts.model.cpp:488: auto it = std::lower_bound(rbegin(m_model_data), rend(m_model_data), timestamp, [](const nlohmann::json& current_json, int timestamp) {
./atomicdex/models/qt.orders.model.cpp:348: .events = nlohmann_json_array_to_qt_json_array(contents.events),
./atomicdex/models/qt.orders.model.cpp:424: update_value(OrdersRoles::EventsRole, nlohmann_json_array_to_qt_json_array(contents.events), idx, *this);
./atomicdex/models/qt.orders.model.cpp:583: this->set_average_events_time_registry(nlohmann_json_object_to_qt_json_object(result.average_events_time));
./atomicdex/models/qt.candlestick.charts.model.hpp:24:#include <nlohmann/json.hpp>
./atomicdex/models/qt.candlestick.charts.model.hpp:114: nlohmann::json m_model_data;
./atomicdex/utilities/global.utilities.hpp:16:#include <nlohmann/json.hpp>
./atomicdex/utilities/global.utilities.hpp:217: struct my_json_sax : nlohmann::json_sax<nlohmann::json>
./atomicdex/utilities/global.utilities.hpp:295: [[maybe_unused]] const nlohmann::detail::exception& ex) override
./atomicdex/utilities/qt.utilities.cpp:29: nlohmann_json_array_to_qt_json_array(const nlohmann::json& j)
./atomicdex/utilities/qt.utilities.cpp:38: nlohmann_json_object_to_qt_json_object(const json& j)
./atomicdex/utilities/cpprestsdk.utilities.cpp:18:#include <nlohmann/json.hpp>
./atomicdex/utilities/cpprestsdk.utilities.cpp:25:create_json_post_request(nlohmann::json&& json_data)
./atomicdex/utilities/qt.utilities.hpp:33: QJsonArray nlohmann_json_array_to_qt_json_array(const nlohmann::json& j);
./atomicdex/utilities/qt.utilities.hpp:34: QJsonObject nlohmann_json_object_to_qt_json_object(const nlohmann::json& j);
./atomicdex/utilities/cpprestsdk.utilities.hpp:19:#include <nlohmann/json_fwd.hpp>
./atomicdex/utilities/cpprestsdk.utilities.hpp:34:t_http_request create_json_post_request(nlohmann::json&& json_data);
./atomicdex/utilities/qt.bindings.hpp:104: inline nlohmann::json
./atomicdex/utilities/qt.bindings.hpp:107: nlohmann::json obj{
./atomicdex/utilities/qt.bindings.hpp:130: nlohmann::json j = nlohmann::json::array();
./atomicdex/utilities/qt.bindings.hpp:142: inline nlohmann::json
./atomicdex/utilities/qt.bindings.hpp:145: nlohmann::json j{
./atomicdex/utilities/qt.bindings.hpp:163: nlohmann::json j = nlohmann::json::array();
./atomicdex/api/mm2/mm2.hpp:24:#include <nlohmann/json.hpp>
./atomicdex/api/mm2/mm2.hpp:42: nlohmann::json rpc_batch_standalone(nlohmann::json batch_array, std::shared_ptr<t_http_client> mm2_client);
./atomicdex/api/mm2/mm2.hpp:44: async_rpc_batch_standalone(nlohmann::json batch_array, std::shared_ptr<t_http_client> mm2_client, pplx::cancellation_token token);
./atomicdex/api/mm2/mm2.hpp:45: nlohmann::json basic_batch_answer(const web::http::http_response& resp);
./atomicdex/api/mm2/mm2.hpp:55: void to_json(nlohmann::json& j, const max_taker_vol_request& cfg);
./atomicdex/api/mm2/mm2.hpp:64: void from_json(const nlohmann::json& j, max_taker_vol_answer_success& cfg);
./atomicdex/api/mm2/mm2.hpp:74: void from_json(const nlohmann::json& j, max_taker_vol_answer& answer);
./atomicdex/api/mm2/mm2.hpp:88: void to_json(nlohmann::json& j, const enable_request& cfg);
./atomicdex/api/mm2/mm2.hpp:99: void from_json(const nlohmann::json& j, const enable_answer& cfg);
./atomicdex/api/mm2/mm2.hpp:119: void to_json(nlohmann::json& j, const electrum_request& cfg);
./atomicdex/api/mm2/mm2.hpp:121: void from_json(const nlohmann::json& j, electrum_answer& answer);
./atomicdex/api/mm2/mm2.hpp:130: void to_json(nlohmann::json& j, const disable_coin_request& req);
./atomicdex/api/mm2/mm2.hpp:137: void from_json(const nlohmann::json& j, disable_coin_answer_success& resp);
./atomicdex/api/mm2/mm2.hpp:147: void from_json(const nlohmann::json& j, disable_coin_answer& resp);
./atomicdex/api/mm2/mm2.hpp:156: void to_json(nlohmann::json& j, const recover_funds_of_swap_request& cfg);
./atomicdex/api/mm2/mm2.hpp:166: void from_json(const nlohmann::json& j, recover_funds_of_swap_answer_success& answer);
./atomicdex/api/mm2/mm2.hpp:176: void from_json(const nlohmann::json& j, recover_funds_of_swap_answer& answer);
./atomicdex/api/mm2/mm2.hpp:195: void to_json(nlohmann::json& j, const balance_request& cfg);
./atomicdex/api/mm2/mm2.hpp:197: void from_json(const nlohmann::json& j, balance_answer& cfg);
./atomicdex/api/mm2/mm2.hpp:206: void to_json(nlohmann::json& j, const trade_fee_request& cfg);
./atomicdex/api/mm2/mm2.hpp:216: void from_json(const nlohmann::json& j, trade_fee_answer& cfg);
./atomicdex/api/mm2/mm2.hpp:225: void from_json(const nlohmann::json& j, fee_regular_coin& cfg);
./atomicdex/api/mm2/mm2.hpp:235: void from_json(const nlohmann::json& j, fee_erc_coin& cfg);
./atomicdex/api/mm2/mm2.hpp:246: void from_json(const nlohmann::json& j, fee_qrc_coin& cfg);
./atomicdex/api/mm2/mm2.hpp:255: void from_json(const nlohmann::json& j, fees_data& cfg);
./atomicdex/api/mm2/mm2.hpp:264: void to_json(nlohmann::json& j, const tx_history_request& cfg);
./atomicdex/api/mm2/mm2.hpp:285: void from_json(const nlohmann::json& j, transaction_data& cfg);
./atomicdex/api/mm2/mm2.hpp:293: void from_json(const nlohmann::json& j, sync_status_additional_error& answer);
./atomicdex/api/mm2/mm2.hpp:300: void from_json(const nlohmann::json& j, sync_status_eth_erc_20_coins& answer);
./atomicdex/api/mm2/mm2.hpp:307: void from_json(const nlohmann::json& j, sync_status_regular_coins& answer);
./atomicdex/api/mm2/mm2.hpp:316: void from_json(const nlohmann::json& j, sync_status_additional_infos& answer);
./atomicdex/api/mm2/mm2.hpp:324: void from_json(const nlohmann::json& j, t_sync_status& answer);
./atomicdex/api/mm2/mm2.hpp:337: void from_json(const nlohmann::json& j, tx_history_answer_success& answer);
./atomicdex/api/mm2/mm2.hpp:347: void from_json(const nlohmann::json& j, tx_history_answer& answer);
./atomicdex/api/mm2/mm2.hpp:359: void to_json(nlohmann::json& j, const withdraw_fees& cfg);
./atomicdex/api/mm2/mm2.hpp:370: void to_json(nlohmann::json& j, const withdraw_request& cfg);
./atomicdex/api/mm2/mm2.hpp:380: void from_json(const nlohmann::json& j, withdraw_answer& answer);
./atomicdex/api/mm2/mm2.hpp:390: void to_json(nlohmann::json& j, const send_raw_transaction_request& cfg);
./atomicdex/api/mm2/mm2.hpp:399: void from_json(const nlohmann::json& j, send_raw_transaction_answer& answer);
./atomicdex/api/mm2/mm2.hpp:409: void to_json(nlohmann::json& j, const orderbook_request& request);
./atomicdex/api/mm2/mm2.hpp:428: void from_json(const nlohmann::json& j, order_contents& contents);
./atomicdex/api/mm2/mm2.hpp:451: void from_json(const nlohmann::json& j, orderbook_answer& answer);
./atomicdex/api/mm2/mm2.hpp:468: void from_json(const nlohmann::json& j, trading_order_contents& contents);
./atomicdex/api/mm2/mm2.hpp:483: void to_json(nlohmann::json& j, const buy_request& request);
./atomicdex/api/mm2/mm2.hpp:490: void from_json(const nlohmann::json& j, buy_answer_success& contents);
./atomicdex/api/mm2/mm2.hpp:500: void from_json(const nlohmann::json& j, buy_answer& answer);
./atomicdex/api/mm2/mm2.hpp:514: void to_json(nlohmann::json& j, const setprice_request& request);
./atomicdex/api/mm2/mm2.hpp:529: void to_json(nlohmann::json& j, const sell_request& request);
./atomicdex/api/mm2/mm2.hpp:536: void from_json(const nlohmann::json& j, sell_answer_success& contents);
./atomicdex/api/mm2/mm2.hpp:546: void from_json(const nlohmann::json& j, sell_answer& answer);
./atomicdex/api/mm2/mm2.hpp:555: void to_json(nlohmann::json& j, const cancel_order_request& request);
./atomicdex/api/mm2/mm2.hpp:565: void from_json(const nlohmann::json& j, cancel_order_answer& answer);
./atomicdex/api/mm2/mm2.hpp:578: void to_json(nlohmann::json& j, const cancel_data& cfg);
./atomicdex/api/mm2/mm2.hpp:586: void to_json(nlohmann::json& j, const cancel_type& cfg);
./atomicdex/api/mm2/mm2.hpp:593: void to_json(nlohmann::json& j, const cancel_all_orders_request& cfg);
./atomicdex/api/mm2/mm2.hpp:603: void from_json(const nlohmann::json& j, cancel_all_orders_answer& answer);
./atomicdex/api/mm2/mm2.hpp:631: void from_json(const nlohmann::json& j, my_orders_answer& answer);
./atomicdex/api/mm2/mm2.hpp:641: void to_json(nlohmann::json& j, const my_recent_swaps_request& request);
./atomicdex/api/mm2/mm2.hpp:654: void from_json(const nlohmann::json& j, started_data& contents);
./atomicdex/api/mm2/mm2.hpp:668: void from_json(const nlohmann::json& j, error_data& contents);
./atomicdex/api/mm2/mm2.hpp:688: nlohmann::json events;
./atomicdex/api/mm2/mm2.hpp:689: nlohmann::json my_info;
./atomicdex/api/mm2/mm2.hpp:700: void from_json(const nlohmann::json& j, swap_contents& contents);
./atomicdex/api/mm2/mm2.hpp:709: nlohmann::json average_events_time;
./atomicdex/api/mm2/mm2.hpp:712: void from_json(const nlohmann::json& j, my_recent_swaps_answer_success& results);
./atomicdex/api/mm2/mm2.hpp:722: void from_json(const nlohmann::json& j, my_recent_swaps_answer& answer);
./atomicdex/api/mm2/mm2.hpp:728: nlohmann::json result;
./atomicdex/api/mm2/mm2.hpp:733: kmd_rewards_info_answer process_kmd_rewards_answer(nlohmann::json result);
./atomicdex/api/mm2/mm2.hpp:735: nlohmann::json rpc_batch_electrum(std::vector<electrum_request> requests, std::shared_ptr<t_http_client> mm2_client);
./atomicdex/api/mm2/mm2.hpp:736: nlohmann::json rpc_batch_enable(std::vector<enable_request> requests, std::shared_ptr<t_http_client> mm2_client);
./atomicdex/api/mm2/mm2.hpp:759: if (auto json_data = nlohmann::json::parse(body); json_data.at("error").is_string())
./atomicdex/api/mm2/mm2.hpp:777: auto json_answer = nlohmann::json::parse(body);
./atomicdex/api/mm2/mm2.hpp:795: RpcReturnType static inline rpc_process_answer_batch(nlohmann::json& json_answer, const std::string& rpc_command) noexcept
./atomicdex/api/mm2/mm2.hpp:841: nlohmann::json template_request(std::string method_name) noexcept;
./atomicdex/api/mm2/mm2.cpp:29: extract_rpc_json_answer(const nlohmann::json& j, RpcReturnType& answer)
./atomicdex/api/mm2/mm2.cpp:47: to_json(nlohmann::json& j, const max_taker_vol_request& cfg)
./atomicdex/api/mm2/mm2.cpp:54: from_json(const nlohmann::json& j, max_taker_vol_answer_success& cfg)
./atomicdex/api/mm2/mm2.cpp:64: from_json(const nlohmann::json& j, max_taker_vol_answer& answer)
./atomicdex/api/mm2/mm2.cpp:82: to_json(nlohmann::json& j, const enable_request& cfg)
./atomicdex/api/mm2/mm2.cpp:93: from_json(const nlohmann::json& j, enable_answer& cfg)
./atomicdex/api/mm2/mm2.cpp:106: to_json(nlohmann::json& j, const electrum_request& cfg)
./atomicdex/api/mm2/mm2.cpp:115: from_json(const nlohmann::json& j, electrum_answer& cfg)
./atomicdex/api/mm2/mm2.cpp:128: to_json(nlohmann::json& j, const disable_coin_request& req)
./atomicdex/api/mm2/mm2.cpp:135: from_json(const nlohmann::json& j, disable_coin_answer_success& resp)
./atomicdex/api/mm2/mm2.cpp:141: from_json(const nlohmann::json& j, disable_coin_answer& resp)
./atomicdex/api/mm2/mm2.cpp:150: to_json(nlohmann::json& j, const balance_request& cfg)
./atomicdex/api/mm2/mm2.cpp:156: from_json(const nlohmann::json& j, balance_answer& cfg)
./atomicdex/api/mm2/mm2.cpp:169: from_json(const nlohmann::json& j, fee_regular_coin& cfg)
./atomicdex/api/mm2/mm2.cpp:175: from_json(const nlohmann::json& j, fee_erc_coin& cfg)
./atomicdex/api/mm2/mm2.cpp:184: from_json(const nlohmann::json& j, fee_qrc_coin& cfg)
./atomicdex/api/mm2/mm2.cpp:194: from_json(const nlohmann::json& j, fees_data& cfg)
./atomicdex/api/mm2/mm2.cpp:214: to_json(nlohmann::json& j, const tx_history_request& cfg)
./atomicdex/api/mm2/mm2.cpp:221: from_json(const nlohmann::json& j, transaction_data& cfg)
./atomicdex/api/mm2/mm2.cpp:246: from_json(const nlohmann::json& j, sync_status_additional_error& answer)
./atomicdex/api/mm2/mm2.cpp:254: from_json(const nlohmann::json& j, sync_status_eth_erc_20_coins& answer)
./atomicdex/api/mm2/mm2.cpp:260: from_json(const nlohmann::json& j, sync_status_regular_coins& answer)
./atomicdex/api/mm2/mm2.cpp:266: from_json(const nlohmann::json& j, sync_status_additional_infos& answer)
./atomicdex/api/mm2/mm2.cpp:283: from_json(const nlohmann::json& j, t_sync_status& answer)
./atomicdex/api/mm2/mm2.cpp:293: from_json(const nlohmann::json& j, tx_history_answer_success& answer)
./atomicdex/api/mm2/mm2.cpp:315: from_json(const nlohmann::json& j, tx_history_answer& answer)
./atomicdex/api/mm2/mm2.cpp:328: to_json(nlohmann::json& j, const recover_funds_of_swap_request& cfg)
./atomicdex/api/mm2/mm2.cpp:330: j["params"] = nlohmann::json::object();
./atomicdex/api/mm2/mm2.cpp:335: from_json(const nlohmann::json& j, recover_funds_of_swap_answer_success& answer)
./atomicdex/api/mm2/mm2.cpp:344: from_json(const nlohmann::json& j, recover_funds_of_swap_answer& answer)
./atomicdex/api/mm2/mm2.cpp:357: to_json(nlohmann::json& j, const withdraw_fees& cfg)
./atomicdex/api/mm2/mm2.cpp:377: to_json(nlohmann::json& j, const withdraw_request& cfg)
./atomicdex/api/mm2/mm2.cpp:390: from_json(const nlohmann::json& j, withdraw_answer& answer)
./atomicdex/api/mm2/mm2.cpp:403: to_json(nlohmann::json& j, const send_raw_transaction_request& cfg)
./atomicdex/api/mm2/mm2.cpp:410: from_json(const nlohmann::json& j, send_raw_transaction_answer& answer)
./atomicdex/api/mm2/mm2.cpp:416: to_json(nlohmann::json& j, const orderbook_request& request)
./atomicdex/api/mm2/mm2.cpp:423: to_json(nlohmann::json& j, const trade_fee_request& cfg)
./atomicdex/api/mm2/mm2.cpp:429: from_json(const nlohmann::json& j, order_contents& contents)
./atomicdex/api/mm2/mm2.cpp:455: from_json(const nlohmann::json& j, orderbook_answer& answer)
./atomicdex/api/mm2/mm2.cpp:501: from_json(const nlohmann::json& j, trade_fee_answer& cfg)
./atomicdex/api/mm2/mm2.cpp:508: to_json(nlohmann::json& j, const setprice_request& request)
./atomicdex/api/mm2/mm2.cpp:519: from_json(const nlohmann::json& j, trading_order_contents& contents)
./atomicdex/api/mm2/mm2.cpp:533: from_json(const nlohmann::json& j, buy_answer_success& contents)
./atomicdex/api/mm2/mm2.cpp:539: from_json(const nlohmann::json& j, buy_answer& answer)
./atomicdex/api/mm2/mm2.cpp:552: to_json(nlohmann::json& j, const buy_request& request)
./atomicdex/api/mm2/mm2.cpp:573: nlohmann::json price_fraction_repr = nlohmann::json::object();
./atomicdex/api/mm2/mm2.cpp:585: to_json(nlohmann::json& j, const sell_request& request)
./atomicdex/api/mm2/mm2.cpp:607: nlohmann::json price_fraction_repr = nlohmann::json::object();
./atomicdex/api/mm2/mm2.cpp:619: from_json(const nlohmann::json& j, sell_answer_success& contents)
./atomicdex/api/mm2/mm2.cpp:625: from_json(const nlohmann::json& j, sell_answer& answer)
./atomicdex/api/mm2/mm2.cpp:638: to_json(nlohmann::json& j, const cancel_order_request& request)
./atomicdex/api/mm2/mm2.cpp:644: from_json(const nlohmann::json& j, cancel_order_answer& answer)
./atomicdex/api/mm2/mm2.cpp:657: to_json(nlohmann::json& j, const cancel_data& cfg)
./atomicdex/api/mm2/mm2.cpp:672: to_json(nlohmann::json& j, const cancel_type& cfg)
./atomicdex/api/mm2/mm2.cpp:682: to_json(nlohmann::json& j, const cancel_all_orders_request& cfg)
./atomicdex/api/mm2/mm2.cpp:688: from_json(const nlohmann::json& j, cancel_all_orders_answer& answer)
./atomicdex/api/mm2/mm2.cpp:695: from_json(const nlohmann::json& j, my_orders_answer& answer)
./atomicdex/api/mm2/mm2.cpp:699: auto filler_functor = [](const std::string& key, const nlohmann::json& value, std::map<std::string, my_order_contents>& out, bool is_maker)
./atomicdex/api/mm2/mm2.cpp:730: to_json(nlohmann::json& j, const my_recent_swaps_request& request)
./atomicdex/api/mm2/mm2.cpp:740: from_json(const nlohmann::json& j, started_data& contents)
./atomicdex/api/mm2/mm2.cpp:746: from_json(const nlohmann::json& j, error_data& contents)
./atomicdex/api/mm2/mm2.cpp:752: from_json(const nlohmann::json& j, swap_contents& contents)
./atomicdex/api/mm2/mm2.cpp:769: contents.events = nlohmann::json::array();
./atomicdex/api/mm2/mm2.cpp:787: const nlohmann::json& j_evt = content.at("event");
./atomicdex/api/mm2/mm2.cpp:793: &total_time_in_ms](nlohmann::json& jf_evt, const std::string& event_type, const std::string& previous_event) {
./atomicdex/api/mm2/mm2.cpp:810: nlohmann::json jf_evt = {{"state", evt_type}, {"human_timestamp", human_date}, {"timestamp", timestamp}};
./atomicdex/api/mm2/mm2.cpp:821: nlohmann::json jf_evt = {{"state", evt_type}, {"human_timestamp", human_date}, {"data", j_evt.at("data")}, {"timestamp", timestamp}};
./atomicdex/api/mm2/mm2.cpp:848: from_json(const nlohmann::json& j, my_recent_swaps_answer_success& results)
./atomicdex/api/mm2/mm2.cpp:854: results.average_events_time = nlohmann::json::object();
./atomicdex/api/mm2/mm2.cpp:878: from_json(const nlohmann::json& j, my_recent_swaps_answer& answer)
./atomicdex/api/mm2/mm2.cpp:989: nlohmann::json json_data = template_request("my_orders");
./atomicdex/api/mm2/mm2.cpp:1012: nlohmann::json json_data = template_request(rpc_command);
./atomicdex/api/mm2/mm2.cpp:1032: nlohmann::json
./atomicdex/api/mm2/mm2.cpp:1041: nlohmann::json json_data = template_request("version");
./atomicdex/api/mm2/mm2.cpp:1052: nlohmann::json body_json = nlohmann::json::parse(body);
./atomicdex/api/mm2/mm2.cpp:1066: process_kmd_rewards_answer(nlohmann::json result)
./atomicdex/api/mm2/mm2.cpp:1070: auto transform_timestamp_into_human_date_functor = [](nlohmann::json& obj, const std::string& field) {
./atomicdex/api/mm2/mm2.cpp:1086: async_rpc_batch_standalone(nlohmann::json batch_array, std::shared_ptr<t_http_client> mm2_http_client, pplx::cancellation_token token)
./atomicdex/api/mm2/mm2.cpp:1099: nlohmann::json
./atomicdex/api/mm2/mm2.cpp:1104: nlohmann::json answer;
./atomicdex/api/mm2/mm2.cpp:1108: answer = nlohmann::json::parse(body);
./atomicdex/api/mm2/mm2.cpp:1110: catch (const nlohmann::detail::parse_error& err)
./atomicdex/api/mm2/mm2.cpp:1118: nlohmann::json
./atomicdex/api/mm2/mm2.cpp:1119: rpc_batch_standalone(nlohmann::json batch_array, std::shared_ptr<t_http_client> mm2_http_client)
./atomicdex/api/mm2/mm2.cpp:1131: nlohmann::json answer;
./atomicdex/api/mm2/mm2.cpp:1135: answer = nlohmann::json::parse(body);
./atomicdex/api/mm2/mm2.cpp:1137: catch (const nlohmann::detail::parse_error& err)
./atomicdex/api/mm2/mm2.cpp:1144: return nlohmann::json::array();
./atomicdex/api/ohlc/ohlc.api.hpp:23:#include <nlohmann/json.hpp>
./atomicdex/api/ohlc/ohlc.api.hpp:53: nlohmann::json raw_result;
./atomicdex/api/ohlc/ohlc.api.hpp:62: void from_json(const nlohmann::json& j, ohlc_answer_success& answer);
./atomicdex/api/ohlc/ohlc.api.hpp:63: void from_json(const nlohmann::json& j, ohlc_answer& answer);
./atomicdex/api/ohlc/ohlc.api.cpp:20:#include <nlohmann/json.hpp>
./atomicdex/api/ohlc/ohlc.api.cpp:36: from_json(const nlohmann::json& j, ohlc_answer_success& answer)
./atomicdex/api/ohlc/ohlc.api.cpp:64: from_json(const nlohmann::json& j, ohlc_answer& answer)
./atomicdex/api/ohlc/ohlc.api.cpp:89: const auto json_answer = nlohmann::json::parse(TO_STD_STR(resp.extract_string(true).get()));
./atomicdex/api/coinpaprika/coinpaprika.cpp:39: to_json(nlohmann::json& j, const price_converter_request& evt)
./atomicdex/api/coinpaprika/coinpaprika.cpp:49: from_json(const nlohmann::json& j, price_converter_answer& evt)
./atomicdex/api/coinpaprika/coinpaprika.cpp:54: nlohmann::json::sax_parse(j.dump(), &sx);
./atomicdex/api/coinpaprika/coinpaprika.cpp:69: from_json(const nlohmann::json& j, ticker_info_answer& evt)
./atomicdex/api/coinpaprika/coinpaprika.cpp:75: from_json(const nlohmann::json& j, ticker_historical_answer& evt)
./atomicdex/api/coinpaprika/coinpaprika.hpp:20:#include <nlohmann/json.hpp>
./atomicdex/api/coinpaprika/coinpaprika.hpp:40: nlohmann::json answer;
./atomicdex/api/coinpaprika/coinpaprika.hpp:53: nlohmann::json answer;
./atomicdex/api/coinpaprika/coinpaprika.hpp:78: void to_json(nlohmann::json& j, const price_converter_request& evt);
./atomicdex/api/coinpaprika/coinpaprika.hpp:80: void from_json(const nlohmann::json& j, price_converter_answer& evt);
./atomicdex/api/coinpaprika/coinpaprika.hpp:82: void from_json(const nlohmann::json& j, ticker_info_answer& evt);
./atomicdex/api/coinpaprika/coinpaprika.hpp:84: void from_json(const nlohmann::json& j, ticker_historical_answer& evt);
./atomicdex/api/coinpaprika/coinpaprika.hpp:112: const auto json_answer = nlohmann::json::parse(body);
./atomicdex/pages/qt.settings.page.cpp:260: nlohmann::json out = nlohmann::json::object();
./atomicdex/pages/qt.settings.page.cpp:261: out["mm2_cfg"] = nlohmann::json::object();
./atomicdex/pages/qt.settings.page.cpp:262: out["adex_cfg"] = nlohmann::json::object();
./atomicdex/pages/qt.settings.page.cpp:265: nlohmann::json body_json = nlohmann::json::parse(body).at("result")[0];
./atomicdex/pages/qt.settings.page.cpp:277: out["mm2_cfg"]["protocol"] = nlohmann::json::object();
./atomicdex/pages/qt.settings.page.cpp:279: out["mm2_cfg"]["protocol"]["protocol_data"] = nlohmann::json::object();
./atomicdex/pages/qt.settings.page.cpp:296: out["adex_cfg"][ticker] = nlohmann::json::object();
./atomicdex/pages/qt.settings.page.cpp:301: nlohmann::json::array({"http://eth1.cipig.net:8555", "http://eth2.cipig.net:8555", "http://eth3.cipig.net:8555"});
./atomicdex/pages/qt.settings.page.cpp:302: out["adex_cfg"][ticker]["explorer_url"] = nlohmann::json::array({"https://etherscan.io/"});
./atomicdex/pages/qt.settings.page.cpp:316: this->set_custom_erc_token_data(nlohmann_json_object_to_qt_json_object(out));
./atomicdex/pages/qt.settings.page.cpp:341: return nlohmann_json_object_to_qt_json_object(m_custom_erc_token_data.get());
./atomicdex/pages/qt.settings.page.cpp:347: nlohmann::json out = nlohmann::json::parse(QString(QJsonDocument(rpc_data.toJsonObject()).toJson()).toStdString());
./atomicdex/pages/qt.settings.page.cpp:356: nlohmann::json out = m_custom_erc_token_data.get();
./atomicdex/pages/qt.trading.page.cpp:79: nlohmann::json j = m_system_manager.get_system<mm2_service>().get_raw_mm2_ticker_cfg(ticker.toStdString());
./atomicdex/pages/qt.trading.page.cpp:80: out = nlohmann_json_object_to_qt_json_object(j);
./atomicdex/pages/qt.trading.page.cpp:118: nlohmann::json batch = nlohmann::json::array();
./atomicdex/pages/qt.trading.page.cpp:122: nlohmann::json cancel_request = ::mm2::api::template_request("cancel_order");
./atomicdex/pages/qt.trading.page.cpp:127: nlohmann::json my_orders_request = ::mm2::api::template_request("my_orders");
./atomicdex/pages/qt.trading.page.cpp:145: nlohmann::json batch = nlohmann::json::array();
./atomicdex/pages/qt.trading.page.cpp:146: nlohmann::json cancel_request = ::mm2::api::template_request("cancel_all_orders");
./atomicdex/pages/qt.trading.page.cpp:163: nlohmann::json my_orders_request = ::mm2::api::template_request("my_orders");
./atomicdex/pages/qt.trading.page.cpp:195: nlohmann::json batch = nlohmann::json::array();
./atomicdex/pages/qt.trading.page.cpp:197: nlohmann::json current_request = ::mm2::api::template_request("get_trade_fee");
./atomicdex/pages/qt.trading.page.cpp:208: auto answers = nlohmann::json::parse(body);
./atomicdex/pages/qt.trading.page.cpp:209: nlohmann::json answer = answers[0];
./atomicdex/pages/qt.trading.page.cpp:248: nlohmann::json batch;
./atomicdex/pages/qt.trading.page.cpp:249: nlohmann::json buy_request = ::mm2::api::template_request("buy");
./atomicdex/pages/qt.trading.page.cpp:261: auto answers = nlohmann::json::parse(body);
./atomicdex/pages/qt.trading.page.cpp:262: nlohmann::json answer = answers[0];
./atomicdex/pages/qt.trading.page.cpp:263: this->set_buy_sell_last_rpc_data(nlohmann_json_object_to_qt_json_object(answer));
./atomicdex/pages/qt.trading.page.cpp:314: nlohmann::json batch;
./atomicdex/pages/qt.trading.page.cpp:315: nlohmann::json sell_request = ::mm2::api::template_request("sell");
./atomicdex/pages/qt.trading.page.cpp:327: auto answers = nlohmann::json::parse(body);
./atomicdex/pages/qt.trading.page.cpp:328: nlohmann::json answer = answers[0];
./atomicdex/pages/qt.trading.page.cpp:329: this->set_buy_sell_last_rpc_data(nlohmann_json_object_to_qt_json_object(answer));
./atomicdex/pages/qt.trading.page.cpp:514: nlohmann::json batch = nlohmann::json::array();
./atomicdex/pages/qt.trading.page.cpp:527: nlohmann::json json = nlohmann::json::parse(QJsonDocument(obj).toJson(QJsonDocument::Compact).toStdString());
./atomicdex/pages/qt.trading.page.cpp:538: nlohmann::json sell_request = ::mm2::api::template_request("sell");
./atomicdex/pages/qt.trading.page.cpp:554: auto answers = nlohmann::json::parse(body);
./atomicdex/pages/qt.wallet.page.cpp:153: obj["trend_7d"] = nlohmann_json_array_to_qt_json_array(paprika.get_ticker_historical(ticker).answer);
./atomicdex/pages/qt.wallet.page.cpp:226: nlohmann::json batch = nlohmann::json::array();
./atomicdex/pages/qt.wallet.page.cpp:234: auto json_fees = nlohmann::json::parse(QString(QJsonDocument(QVariant(fees_data).toJsonObject()).toJson()).toStdString());
./atomicdex/pages/qt.wallet.page.cpp:249: nlohmann::json json_data = ::mm2::api::template_request("withdraw");
./atomicdex/pages/qt.wallet.page.cpp:270: auto answers = nlohmann::json::parse(body);
./atomicdex/pages/qt.wallet.page.cpp:272: nlohmann::json j_out = nlohmann::json::object();
./atomicdex/pages/qt.wallet.page.cpp:308: this->set_rpc_send_data(nlohmann_json_object_to_qt_json_object(j_out));
./atomicdex/pages/qt.wallet.page.cpp:332: nlohmann::json batch = nlohmann::json::array();
./atomicdex/pages/qt.wallet.page.cpp:334: nlohmann::json json_data = ::mm2::api::template_request("send_raw_transaction");
./atomicdex/pages/qt.wallet.page.cpp:345: auto answers = nlohmann::json::parse(body);
./atomicdex/pages/qt.wallet.page.cpp:373: nlohmann::json batch = nlohmann::json::array();
./atomicdex/pages/qt.wallet.page.cpp:377: nlohmann::json json_data = ::mm2::api::template_request("withdraw");
./atomicdex/pages/qt.wallet.page.cpp:388: auto answers = nlohmann::json::parse(body);
./atomicdex/pages/qt.wallet.page.cpp:390: nlohmann::json j_out = nlohmann::json::object();
./atomicdex/pages/qt.wallet.page.cpp:395: this->set_rpc_claiming_data(nlohmann_json_object_to_qt_json_object(j_out));
./atomicdex/pages/qt.settings.page.hpp:29:#include <nlohmann/json.hpp>
./atomicdex/pages/qt.settings.page.hpp:52: using t_synchronized_json = boost::synchronized_value<nlohmann::json>;
./atomicdex/services/mm2/mm2.service.cpp:51: nlohmann::json precedent_config_json_data;
./atomicdex/services/mm2/mm2.service.cpp:58: nlohmann::json actual_config_data;
./atomicdex/services/mm2/mm2.service.cpp:95: nlohmann::json config_json_data;
./atomicdex/services/mm2/mm2.service.cpp:123: nlohmann::json config_json_data;
./atomicdex/services/mm2/mm2.service.cpp:400: std::tuple<nlohmann::json, std::vector<std::string>, std::vector<std::string>>
./atomicdex/services/mm2/mm2.service.cpp:404: nlohmann::json batch_array = nlohmann::json::array();
./atomicdex/services/mm2/mm2.service.cpp:411: nlohmann::json j = ::mm2::api::template_request("my_tx_history");
./atomicdex/services/mm2/mm2.service.cpp:428: nlohmann::json j = ::mm2::api::template_request("my_balance");
./atomicdex/services/mm2/mm2.service.cpp:464: nlohmann::json btc_kmd_batch = nlohmann::json::array();
./atomicdex/services/mm2/mm2.service.cpp:469: nlohmann::json j = ::mm2::api::template_request("electrum");
./atomicdex/services/mm2/mm2.service.cpp:479: nlohmann::json batch_array = nlohmann::json::array();
./atomicdex/services/mm2/mm2.service.cpp:497: nlohmann::json j = ::mm2::api::template_request("electrum");
./atomicdex/services/mm2/mm2.service.cpp:504: nlohmann::json j = ::mm2::api::template_request("enable");
./atomicdex/services/mm2/mm2.service.cpp:510: nlohmann::json empty = "{}"_json;
./atomicdex/services/mm2/mm2.service.cpp:522: auto functor = [this](nlohmann::json batch_array, std::vector<std::string> tickers) {
./atomicdex/services/mm2/mm2.service.cpp:612: nlohmann::json
./atomicdex/services/mm2/mm2.service.cpp:617: return nlohmann::json::array();
./atomicdex/services/mm2/mm2.service.cpp:618: nlohmann::json batch = nlohmann::json::array();
./atomicdex/services/mm2/mm2.service.cpp:620: nlohmann::json current_request = ::mm2::api::template_request("orderbook");
./atomicdex/services/mm2/mm2.service.cpp:776: nlohmann::to_json(json_cfg, cfg);
./atomicdex/services/mm2/mm2.service.cpp:905: nlohmann::json batch = nlohmann::json::array();
./atomicdex/services/mm2/mm2.service.cpp:906: nlohmann::json my_orders_request = ::mm2::api::template_request("my_orders");
./atomicdex/services/mm2/mm2.service.cpp:908: nlohmann::json my_swaps = ::mm2::api::template_request("my_recent_swaps");
./atomicdex/services/mm2/mm2.service.cpp:1201: nlohmann::json
./atomicdex/services/mm2/mm2.service.cpp:1204: nlohmann::json out;
./atomicdex/services/mm2/mm2.service.cpp:1211: return nlohmann::json::object();
./atomicdex/services/mm2/mm2.service.cpp:1257: mm2_service::process_tx_answer(const nlohmann::json& answer_json)
./atomicdex/services/mm2/mm2.service.cpp:1332: mm2_service::process_balance_answer(const nlohmann::json& answer)
./atomicdex/services/mm2/mm2.service.cpp:1350: nlohmann::json
./atomicdex/services/mm2/mm2.service.cpp:1355: return nlohmann::json::array();
./atomicdex/services/mm2/mm2.service.cpp:1356: nlohmann::json batch = nlohmann::json::array();
./atomicdex/services/mm2/mm2.service.cpp:1358: nlohmann::json current_request = ::mm2::api::template_request("get_trade_fee");
./atomicdex/services/mm2/mm2.service.cpp:1417: mm2_service::add_new_coin(const nlohmann::json& coin_cfg_json, const nlohmann::json& raw_coin_cfg_json) noexcept
./atomicdex/services/mm2/mm2.service.cpp:1427: nlohmann::json config_json_data;
./atomicdex/services/mm2/mm2.service.cpp:1451: nlohmann::json config_json_data;
./atomicdex/services/mm2/mm2.service.cpp:1510: nlohmann::json config_json_data;
./atomicdex/services/mm2/mm2.service.cpp:1534: nlohmann::json config_json_data;
./atomicdex/services/mm2/mm2.service.cpp:1540: config_json_data.erase(std::find_if(begin(config_json_data), end(config_json_data), [ticker](nlohmann::json current_elem) {
./atomicdex/services/mm2/mm2.service.hpp:139: nlohmann::json prepare_batch_orderbook();
./atomicdex/services/mm2/mm2.service.hpp:143: nlohmann::json prepare_process_fees_and_current_orderbook();
./atomicdex/services/mm2/mm2.service.hpp:146: std::tuple<nlohmann::json, std::vector<std::string>, std::vector<std::string>> prepare_batch_balance_and_tx(bool only_tx = false) const;
./atomicdex/services/mm2/mm2.service.hpp:148: void process_balance_answer(const nlohmann::json& answer);
./atomicdex/services/mm2/mm2.service.hpp:149: void process_tx_answer(const nlohmann::json& answer_json);
./atomicdex/services/mm2/mm2.service.hpp:153: std::pair<bool, std::string> process_batch_enable_answer(const nlohmann::json& answer);
./atomicdex/services/mm2/mm2.service.hpp:197: void add_new_coin(const nlohmann::json& coin_cfg_json, const nlohmann::json& raw_coin_cfg_json) noexcept;
./atomicdex/services/mm2/mm2.service.hpp:277: [[nodiscard]] nlohmann::json get_raw_mm2_ticker_cfg(const std::string& ticker) const noexcept;
./atomicdex/services/update/update.checker.service.cpp:22:#include <nlohmann/json.hpp>
./atomicdex/services/update/update.checker.service.cpp:38: nlohmann::json json_data{{"currentVersion", atomic_dex::get_raw_version()}};
./atomicdex/services/update/update.checker.service.cpp:42: nlohmann::json
./atomicdex/services/update/update.checker.service.cpp:46: nlohmann::json resp;
./atomicdex/services/update/update.checker.service.cpp:53: resp = nlohmann::json::parse(TO_STD_STR(resp_http.extract_string(true).get()));
./atomicdex/services/update/update.checker.service.cpp:78: m_update_status = nlohmann::json::object();
./atomicdex/services/update/update.checker.service.cpp:111: nlohmann::json
./atomicdex/services/update/update.checker.service.hpp:20:#include <nlohmann/json_fwd.hpp>
./atomicdex/services/update/update.checker.service.hpp:32: using t_json_synchronized = boost::synchronized_value<nlohmann::json>;
./atomicdex/services/update/update.checker.service.hpp:50: [[nodiscard]] nlohmann::json get_update_status() const noexcept;
./atomicdex/services/ohlc/ohlc.provider.hpp:20:#include <nlohmann/json_fwd.hpp>
./atomicdex/services/ohlc/ohlc.provider.hpp:42: using t_synchronized_json = boost::synchronized_value<nlohmann::json>;
./atomicdex/services/ohlc/ohlc.provider.hpp:64: void reverse_ohlc_data(nlohmann::json& cur_range) noexcept;
./atomicdex/services/ohlc/ohlc.provider.hpp:91: nlohmann::json get_ohlc_data(const std::string& range) noexcept;
./atomicdex/services/ohlc/ohlc.provider.hpp:93: nlohmann::json get_all_ohlc_data() noexcept;
./atomicdex/services/ohlc/ohlc.provider.cpp:21:#include <nlohmann/json.hpp>
./atomicdex/services/ohlc/ohlc.provider.cpp:75: m_current_ohlc_data = nlohmann::json::array();
./atomicdex/services/ohlc/ohlc.provider.cpp:148: nlohmann::json
./atomicdex/services/ohlc/ohlc.provider.cpp:151: nlohmann::json res = nlohmann::json::array();
./atomicdex/services/ohlc/ohlc.provider.cpp:160: ohlc_provider::reverse_ohlc_data(nlohmann::json& cur_range) noexcept
./atomicdex/services/ohlc/ohlc.provider.cpp:171: nlohmann::json
./atomicdex/services/ohlc/ohlc.provider.cpp:180: nlohmann::json ohlc_data = *this->m_current_ohlc_data;
./atomicdex/services/ohlc/ohlc.provider.cpp:181: auto add_moving_average_functor = [](nlohmann::json& current_item, std::size_t idx, const std::vector<double>& sums, std::size_t num) {
./atomicdex/services/price/global.provider.hpp:11: using t_json_synchronized = boost::synchronized_value<nlohmann::json>;
./atomicdex/services/price/oracle/band.provider.hpp:21: void from_json(const nlohmann::json& j, band_oracle_price_result& result);
./atomicdex/services/price/oracle/band.provider.cpp:16: from_json(const nlohmann::json& j, band_oracle_price_result& result)
./atomicdex/services/price/oracle/band.provider.cpp:43: nlohmann::json json_body;
./atomicdex/services/price/oracle/band.provider.cpp:46: json_body["symbols"] = nlohmann::json::array();
./atomicdex/services/price/oracle/band.provider.cpp:63: nlohmann::json j = nlohmann::json::parse(body);
./atomicdex/services/price/global.provider.cpp:21: nlohmann::json
./atomicdex/services/price/global.provider.cpp:24: nlohmann::json answer;
./atomicdex/services/price/global.provider.cpp:27: answer = nlohmann::json::parse(TO_STD_STR(resp.extract_string(true).get()));
./atomicdex/services/price/coinpaprika/coinpaprika.provider.cpp:330: : t_ticker_historical_answer{.answer = nlohmann::json::array()};
./atomicdex/services/internet/internet.checker.service.cpp:21:#include <nlohmann/json.hpp>
./atomicdex/services/ip/ip.checker.service.cpp:21:#include <nlohmann/json.hpp>
./atomicdex/services/ip/ip.checker.service.cpp:66: auto answer = nlohmann::json::parse(body);
./atomicdex/app.cpp:474: nlohmann::json j = to_qt_binding(get_mm2().get_coin_info(ticker.toStdString()));
./atomicdex/app.cpp:691: auto j = nlohmann::json::parse(swaps);
cc @ca333 (will make the decision if we (long-term) switch to this library)
Ty @vinniefalco for the advice we will ping you if any question
Yeah that is quite a few references
As soon boost 1.75 is merged into vcpkg i will start checking for some usage of Boost.Json
@vinniefalco I think I will stop using C++ concrete types for rpc and json, maybe I should use json::object
or json::array
directly right?
What do you think is the best approach?
1 - Parse json into a json::object
2 - Manipulate / Modify json::object
3 - to_string(json::object) -> send rpc data
Yes that works, or you can use json::value
which is the variant container. to_string
is easy to use and will work, and later if you want more performance you can get fancy with the stack-based memory resources and serializer
.
I see that this project is using nlohmann. Did you know that Boost.JSON has been accepted into Boost and will be in the next release? (it is already available as a repository with no dependencies). It offers a modern interface, security-awareness (hash tables are salted to prevent algorithmic complexity attacks), and memory controls over the streaming parser. It is also many times faster. Please check it out! https://github.com/boostorg/json