Skip to content

JSON Parse throwing error #2983

Description

@nulliousp

The JSON Parse is giving an error and I don't know why. I have code in a try-catch and it still throws an error, although I am not sure what line it is on..

        #include "json/json.hpp"
        #include <string>
        #include <stream>
        #include <experimental/filesystem>
        #include <iostream>
        #define CURRENTFILESTRING __FILE__
        
        using json = nlohmann::json;
        
        std::experimental::filesystem::v1::path temppath = CURRENTFILESTRING;
        std::experimental::filesystem::v1::directory_iterator dir( temppath.parent_path() / "Json" );
        int main() {
        for (auto& p : std::experimental::filesystem::directory_iterator(dir)) {
        auto path = p.path().filename();
        std::ifstream comp("Json" / path, std::ifstream::binary);
        //delete &path;
        json compData;
        try {
            compData = json::parse(temppath.parent_path() / "Json" / path);
        }
        catch (json::parse_error& e)
        {
            std::cerr << e.what() << std::endl;
        }
        }
        }

I want it to read the JSON file.

It just throws an error and I have no idea what it means.

  • Compiler: Visual Studio 2019 (ISO C++ 14 Standard)
  • Operating system: Windows 10 Home

the develop branch

Error C2672 'nlohmann::detail::wide_string_input_adapter<nlohmann::detail::iterator_input_adapter<std::experimental::filesystem::v1::_Path_iteratorstd::experimental::filesystem::v1::path>,std::experimental::filesystem::v1::path>::fill_buffer': no matching overloaded function found

It is on line 5651 in json.hpp, I am also using the single-include.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions