ScuffedItalian1248
New member
- Joined
- Jan 4, 2023
- Messages
- 1
- Programming Experience
- Beginner
I've deserialized a json file using the code below. I then add a new 'object' to that json file named _customData, now when I do this I get the error System.ArgumentException: 'Could not determine JSON object type for type <>f__AnonymousType0`2[System.Object[],System.Object[]].' at the line where I try to add that "object"
Here is the entire json file:
C#:
const string Input = "C:\\Program Files (x86)\\Steam\\steamapps\\common\\Beat Saber\\Beat Saber_Data\\CustomWIPLevels\\CMapper Testing\\EasyStandard.dat";
const string Output = "C:\\Program Files (x86)\\Steam\\steamapps\\common\\Beat Saber\\Beat Saber_Data\\CustomWIPLevels\\CMapper Testing\\ExpertPlusStandard.dat";
dynamic mapRead = File.ReadAllText(Input);
dynamic mapWrite = File.ReadAllText(Output);
dynamic map = JsonConvert.DeserializeObject<dynamic>(mapRead);
C#:
map._customData = new { _environment = new object[0], _customEvents = new object[0] };
Here is the entire json file:
JSON:
{
"_version":"2.2.0",
"_notes":[
{
"_time":0,
"_lineIndex":1,
"_lineLayer":0,
"_type":0,
"_cutDirection":1
},
{
"_time":0,
"_lineIndex":2,
"_lineLayer":0,
"_type":1,
"_cutDirection":1
},
{
"_time":1,
"_lineIndex":1,
"_lineLayer":1,
"_type":0,
"_cutDirection":0
},
{
"_time":1,
"_lineIndex":2,
"_lineLayer":1,
"_type":1,
"_cutDirection":0
},
{
"_time":2,
"_lineIndex":1,
"_lineLayer":0,
"_type":0,
"_cutDirection":1
},
{
"_time":2,
"_lineIndex":2,
"_lineLayer":0,
"_type":1,
"_cutDirection":1
}
],
"_obstacles":[
],
"_events":[
],
"_waypoints":[
],
"_customData":{
"_time":0.234
}
}
Last edited by a moderator: