Open CrackerHax opened 6 years ago
The following is valid json: [["stringa","stringb"]]
string line = "[[\"stringa\",\"stringb\"]]"; Document d; d.Parse(line.c_str()); string s1 = d[0].GetString(); cout<<s1<<endl; string s2 = d[1].GetString(); cout<<s2<<endl;
stringa comes out fine but stringb throws an error
terminate called after throwing an instance of 'std::logic_error' what(): basic_string::_M_construct null not valid
It should be d[0][0].GetString(), d[0][1].GetString(). By the way, it should assert in debug configuration as d[0].IsString() will be false.
d[0][0].GetString()
d[0][1].GetString()
d[0].IsString()
The following is valid json: [["stringa","stringb"]]
stringa comes out fine but stringb throws an error