29#define JSON_USE_IMPLICIT_CONVERSIONS 0
30#include "nlohmann_json.hpp"
40 }
catch (std::exception& e) {
42 s <<
"cannot parse input JSON" << std::endl << e.what();
49inline nlohmann::json read_json_from_file(std::string
const &filename) {
50 std::ifstream file{filename};
51 if (!file.is_open()) {
53 s <<
"file " << filename <<
" can't be opened";
60inline nlohmann::json read_json_from_string(std::string
const &str) {
64 std::istringstream input{str};
68inline nlohmann::json read_json_from_file_or_string(std::string
const& str__)
74 if (str__.find(
"{") == std::string::npos) {
75 return read_json_from_file(str__);
77 return read_json_from_string(str__);
nlohmann::json try_parse(std::istream &is)
Read json dictionary from file or string.
Eror and warning handling during run-time execution.