Skip to content

Application terminating #830

Description

@lvkins

When I'm trying to run compiled application with simple parse code it fails with an exception:

[json.exception.parse_error.101] parse error at 73: syntax error - unexpected '}'; expected string literal

Code:

int main() {
    std::ifstream     file("test.json");
    std::stringstream buffer;
    buffer << file.rdbuf();

    json config;

    try {
        config = json::parse(buffer);
    } catch (const json::exception& e) {
        std::cout << "Loading error: " << e.what() << "\n";
        exit(-1);
    }

    try {
        std::cout << "Name: " << config["name"] << "\n";
    } catch (const json::exception& e) {
        std::cout << "Couldnt parse: " << e.what() << "\n";
        exit(-1);
    }
    return 0;
}

JSON file is indeed valid:

{
  "pi": 3.141,
  "happy": true,
  "name": "Niels",
  "nothing": null,
}

Compiler:

Thread model: win32
gcc version 6.3.0 (MinGW.org GCC-6.3.0-1)

Bug or something I'm doing wrong?

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

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions