Though this topic is a bit old, I've been facing unknown issues reading local JSON files as well. Rapidjson failed to parse certain JSON files most of the time, without any specific pattern, when I was useing:
After lot of head scratching, I found this thread which mentioned about using the following, but with the problem of unwanted additional characters in the return string:
FileUtils::getInstance()->getFileData("Filename.json", "r", &size);
I used getFileData() method and added a flag to the RapidJSON parse method to solve this issue, and it seems to be working fine now. I parsed the returned string as below:
Please note the rapidjson::ParseFlag::kParseStopWhenDoneFlag, which is being used in place of the normally used 0 (zero). This allows proper parsing of the file, even when it has additional content beyond the last closing brace in the JSON string.
Perhaps this may help someone who may be facing similar issues that I had faced.