#include #include #include using namespace jjx; void ParseJsonFile(const std::string& file_path) { std::ifstream file(file_path, std::ios::binary); if (!file) throw std::runtime_error("We couldn't find the file: " + file_path); std::streamsize file_size; file.seekg(0, std::ios::end); file_size = file.tellg(); file.seekg(0, std::ios::beg); std::string file_content(file_size, '\0'); file.read(&file_content[0], file_size); file.close(); auto [text, parse_error] = json::parse(file_content); if (!parse_error.empty()) std::cerr << "Error while parsing json: " << parse_error << std::endl; std::cout << json::deparse(text) << std::endl; } int main(int argc, char* argv[]) { ParseJsonFile("../samples/widgets.json"); }