trajopt
 All Classes Namespaces Files Functions Variables Typedefs Pages
trajopt_test_utils.hpp
1 #include <json/json.h>
2 #include <fstream>
3 #include <stdexcept>
4 
5 Json::Value readJsonFile(const std::string& fname) {
6  Json::Value root;
7  Json::Reader reader;
8  std::ifstream fh(fname.c_str());
9  bool parse_success = reader.parse(fh, root);
10  if (!parse_success) throw std::runtime_error("failed to parse " +fname);
11  return root;
12 }