Skip to content

std::ifstream >> json error #1948

@finnwrt

Description

@finnwrt
  • What is the issue you have?
    I'm trying to open a file and put the contents in a json object

  • Please describe the steps to reproduce the issue. Can you provide a small but working code example?

#include <fstream>
#include "json.hpp"
using json = nlohmann::json;

void foo() {
     std::ifstream i("file.txt");
     json j;
     i >> j;
}
  • And what is the actual behavior instead?
    Error: C++ no operator matches these operands operand types are: std::ifstream >> json

  • Which compiler and operating system are you using? Is it a supported compiler?
    Windows 10, VS2019

  • Did you use a released version of the library or the version from the develop branch?
    Latest release of json.hpp

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions