When the JsonReader executes JsonReader::ReadStart(…) and tries to find the next token with JsonReader::NextToken(…), then the outcome of this
CharType Char;
Stream->Serialize(&Char, sizeof(CharType));
is this:
Obviously, it should be ‘{’.
This is the json I’m using (taken from JSON Example ):
{
"glossary": {
"title": "example glossary",
"GlossDiv": {
"title": "S",
"GlossList": {
"GlossEntry": {
"ID": "SGML",
"SortAs": "SGML",
"GlossTerm": "Standard Generalized Markup Language",
"Acronym": "SGML",
"Abbrev": "ISO 8879:1986",
"GlossDef": {
"para": "A meta-markup language, used to create markup languages such as DocBook.”,
"GlossSeeAlso": ["GML", "XML"]
},
"GlossSee": "markup"
}
}
}
}
}
And this the code:
FArchive* SaveFile = IFileManager::Get().CreateFileReader(*FPaths::GameConfigDir().Append(FString("data2.json")));
if (SaveFile)
{
TSharedPtr<FJsonObject> JsonObject = MakeShareable(new FJsonObject());
TSharedRef<TJsonReader<TCHAR>> JsonReader = TJsonReaderFactory<TCHAR>::Create(SaveFile);
UE_LOG(LogEngine, Error, TEXT("JSONERROR: %s"), *JsonReader->GetErrorMessage());
const bool ds = FJsonSerializer::Deserialize(JsonReader, JsonObject);
I’m on OSX.
Encoding: file -I gave me us-ascii first. I added an ä and saved which resulted in it being utf-8. Still the same weird character being read.
Any ideas? : /