Hi, thanks for the responses! However, I think youâve misunderstood my question. Here are the JSON outputs produced by:
- A (using JsonConvert.SerializeObject with my custom JsonSerializerSettings):
{
"CategoryDatas": {
"currency": {
"$type": "Game.Feature.Inventory.Data.CurrencyCategoryData, Assembly-CSharp",
"CategoryId": "currency",
"CategoryItems": [
{
"$type": "Game.Feature.Inventory.Data.CurrencyItemData, Assembly-CSharp",
"ItemId": "currency.gold",
"Quantity": {
"Value": 0
}
},
{
"$type": "Game.Feature.Inventory.Data.CurrencyItemData, Assembly-CSharp",
"ItemId": "currency.golden-fish",
"Quantity": {
"Value": 42
}
},
{
"$type": "Game.Feature.Inventory.Data.CurrencyItemData, Assembly-CSharp",
"ItemId": "currency.pearl",
"Quantity": {
"Value": 8
}
}
]
},
"expirable": {
"$type": "Game.Feature.Inventory.Data.ExpirableCategoryData, Assembly-CSharp",
"CategoryId": "expirable",
"CategoryItems": [
{
"$type": "Game.Feature.Inventory.Data.ExpirableItemData, Assembly-CSharp",
"ItemId": "expirable.vip",
"Quantity": {
"Value": 0
},
"StartedTime": 0
}
]
}
}
}
-B (using CloudSaveSDK default JsonSerializerSettings):
{
"CategoryDatas": {
"currency": {
"CategoryId": "currency",
"CategoryItems": [
{
"ItemId": "currency.gold",
"Quantity": {
"Value": 0
}
},
{
"ItemId": "currency.golden-fish",
"Quantity": {
"Value": 0
}
},
{
"ItemId": "currency.pearl",
"Quantity": {
"Value": 0
}
}
]
},
"expirable": {
"CategoryId": "expirable",
"CategoryItems": [
{
"ItemId": "expirable.vip",
"Quantity": {
"Value": 0
},
"StartedTime": 0
}
]
}
}
}
Here is also the code snippet to generate the above JSONs
As you can see, the result from B is missing the $type attribute (and there are actually more cases like this from another data). This is why I have a function ConvertToDictionary that first serializes my object into a JSON string and then puts it into a Dictionary<string, object>.
So, letâs go back to my question:
- Is there any way I can customize the JsonSerializerSettings of the CloudSaveSystem?
And then simply put my object into the Dictionary<string, object>? Or perhaps, a better method would be to ignore the SDKâs serialization when the object is a string?
Sorry if I have any misunderstanding here! Iâll provide more information if any part wasnât clear enough.
Thank you!