From de2001a4424ce99a5552823f2f99bf4c8a17872b Mon Sep 17 00:00:00 2001 From: tastytea Date: Tue, 1 Jun 2021 21:17:29 +0200 Subject: [PATCH] Fix nlohmann_json error with old versions. Old versions of nlohmann_json do not have support for std::string_view, std::filesystem::::path(?) and std::pair(?). --- src/output.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/output.cpp b/src/output.cpp index 2ea5ba3..de9c1fc 100644 --- a/src/output.cpp +++ b/src/output.cpp @@ -117,17 +117,17 @@ void json_all(const std::vector> &matches_all) { nlohmann::json json; - json["generator"] = {{"epubgrep", version}}; + json["generator"] = {{"epubgrep", std::string(version)}}; for (const auto &matches : matches_all) { for (const auto &match : matches) { json["matches"].push_back( - {{"filepath_epub", match.filepath_epub}, + {{"filepath_epub", match.filepath_epub.string()}, {"filepath_inside", match.filepath_inside}, {"match", match.text}, - {"context", match.context}, + {"context", {match.context.first, match.context.second}}, {"headline", match.headline}, {"page", match.page}}); }