Page MenuHomeFeedback Tracker

JsonFileLoader expects wrong types when reading maps
Closed, ResolvedPublic

Description

Trying to read the map of strings and following data structure:

typedef map<string, ref TheFollowingDataStructure> TFDSMap;

class TheFollowingDataStructure {
	int SomeId;
	int SomeColor;
	ref TStringArray SomeSArray;

	void TheFollowingDataStructure() {
		SomeId = 0;
		SomeColor = 0xDEADBEEF;
		SomeSArray = new TStringArray;
		SomeSArray.Insert("I dont feel quite well, Mr. rVn");
	}
}

When I'm saving it using JsonFileLoader<TFDSMap>.JsonSaveFile with one element, it seems fine, file contents:

{
    "TheFirstItem": {
        "SomeId": 0,
        "SomeColor": -559038737,
        "SomeSArray": [
            "I dont feel quite well, Mr. rVn"
        ]
    }
}

But! When we're trying to read this file using JsonFileLoader<TFDSMap>.JsonLoadFile, it throws this:

JSON ERROR:
Reading variable: data
Expecting map
Expecting instance
Reading variable: SomeId
Expecting key
Cannot convert key to int

Function: 'Error'
Stack trace:
scripts/1_Core/proto\endebug.c:44
scripts/3_Game/tools\jsonfileloader.c:29
...

Why on earth would it expect a key there? I dunno. But the result is pretty obvious, no data is getting back :c

Details

Severity
Major
Resolution
Open
Reproducibility
Always
Operating System
Windows 10 x64
Operating System Version
1903, build 18362.239
Category
General
Steps To Reproduce
  1. Try to read map<string, ref SomeClassWithIntsAndArrays> from file
  2. ???????
  3. Profit!
Additional Information

Might be related to T142438
First encountered in: DayZ 1.04.152166

Event Timeline

3Vaker created this task.Aug 4 2019, 7:57 PM
Geez changed the task status from New to Acknowledged.Aug 5 2019, 2:07 PM
Geez closed this task as Resolved.May 27 2022, 11:27 AM
Geez claimed this task.
Geez added a subscriber: Geez.

Hello daemonforge.
The problem has been fixed internally and the fix will appear in one of the upcoming updates.
Regards,
Geez