Tencent / rapidjson

A fast JSON parser/generator for C++ with both SAX/DOM style API
http://rapidjson.org/
Other
14.24k stars 3.54k forks source link

rapid json failing in error in document.h #928

Open tiwarisarthak opened 7 years ago

tiwarisarthak commented 7 years ago

I have the following code

ifstream fin;
    fin.open("config.json", ios::in);
    char a[500];
    int size=0;
    while(!fin.eof())
    {
        fin.get(a[size]);
        ++size;
    }
    a[size]='\0';

    string b(a);
    fin.close();
    const char *work = b.c_str();

    Document document;
    document.Parse(work);
    assert(document.IsObject());
    assert(document.HasMember("id"));

        assert(document["id"].IsString());
        string id_match="assetexplorer";
        string config_id(document["id"].GetString());

        assert(document.HasMember("type"));
        assert(document["type"].IsString());
        string type_match="config";
        string config_type(document["type"].GetString());

the contents of the json file are { "id": "assetexplorer", "type": "config", "method": "log", "extractparam": "C://windows" }

The program keeps failing with the following error.

Assertion failed: false, file e:\poc\rapidjson/document.h, line 1103

The directory is the location of the file in my directory.

Bu11etmagnet commented 7 years ago

What's on line 1103 of document.h ?

OlafvdSpek commented 7 years ago

Try to shorten the test case to the minimal one that still exhibits the issue.