| 4 | #include "sonic/sonic.h" |
| 5 | |
| 6 | void parse_json(const std::string& data) { |
| 7 | sonic_json::Document doc; |
| 8 | doc.Parse(data); |
| 9 | if (doc.HasParseError()) { |
| 10 | std::cout << sonic_json::ErrorMsg(doc.GetParseError()) << std::endl |
| 11 | << "Json: \n" |
| 12 | << data << std::endl |
| 13 | << "Error offset is: " << doc.GetErrorOffset() << std::endl; |
| 14 | } else { |
| 15 | std::cout << "Parse json:\n" << data << "\n successfully"; |
| 16 | } |
| 17 | } |
| 18 | |
| 19 | int main() { |
| 20 | parse_json(R"({"a":"b",)"); |
no test coverage detected