Hi I hope someone can help me.
I’m currently loading in json data but sometimes a key doesn’t get parsed correctly.
It usually is the last key in the file. I have posted the json file below
{
"events" : [
{
"name" : "wealth",
"type" : "wealth-add",
"basefirechance" : 5000,
"value" : {"job": "value"},
"restrictions" : [
{ "job" : "any"}
]
},
{
"name" : "birth",
"type" : "birth",
"basefirechance" : 2500,
"restrictions" : [
{ "sex" : "female" },
{ "age" : { "greater" : 16 } }
],
"modifiers" : [
{"decrease" : { "age" : [ 100, {"above" : 16}]}}
]
},
{
"name" : "death",
"type" : "death",
"basefirechance" : 100,
"restrictions" : [],
"modifiers" : [
{"increase" : { "age" : [25, {"above" : 16}]}}
]
},
{
"name" : "farmer-job",
"type" : "job",
"basefirechance" : 5000,
"value" : { "job" : "farmer"},
"restrictions" : [
{ "job" : "none"},
{ "age" : { "greater" : 16 } }
]
},
{
"name" : "miner-job",
"type" : "job",
"basefirechance" : 5000,
"value" : { "job" : "miner"},
"restrictions" : [
{ "job" : "none"},
{ "age" : { "greater" : 16 } }
]
},
{"end" : "end"}
]
}
In my program the last “greater” key sometimes is empty. I have pasted an extra object with another key and this seems to help a bit as the problem seems to occur less frequently but it doesn’t eliminate it completely. I have checked to string that is loaded in and it seems to be correct. My thoughts are that something goes wrong during deserialization. Is there someone who has had similar issues or knows what might be the problem. I’m running version 4.4 of the engine I don’t know if this issue might have been fixed in version 4.5. Any help is welcome.