| 45 | { |
| 46 | |
| 47 | inline StatusWithReason parseJson(const std::string& s, NL::json& json) |
| 48 | { |
| 49 | try |
| 50 | { |
| 51 | json = NL::json::parse(s); |
| 52 | } |
| 53 | catch (NL::json::parse_error& err) |
| 54 | { |
| 55 | // Look for a right bracket -- this indicates the start of the |
| 56 | // actual message from the parse error. |
| 57 | std::string s(err.what()); |
| 58 | auto pos = s.find(']'); |
| 59 | if (pos != std::string::npos) |
| 60 | s = s.substr(pos + 1); |
| 61 | return { -1, s }; |
| 62 | } |
| 63 | return true; |
| 64 | } |
| 65 | |
| 66 | inline std::string inferJsonType(const std::string& s) |
| 67 | { |