1#include <iostream> 2#include <nlohmann/json.hpp> 3 4using json = nlohmann::json; 5 6int main() 7{ 8 try 9 { 10 // parsing input with a syntax error 11 json::parse("[1,2,3,]"); 12 } 13 catch (json::parse_error& e) 14 { 15 // output exception information 16 std::cout << "message: " << e.what() << '\n' 17 << "exception id: " << e.id << '\n' 18 << "byte position of error: " << e.byte << std::endl; 19 } 20} 21