JsonSerializer.Serialize skips children
I have a somewhat complex object, but when I serialize it to json I dont get all the children serialized correctly. The arrays are empty even though they should not be,.
Output:
AkPropBundle1 should contain 4 items.
var hircAsString = JsonSerializer.Serialize((object)selectedNode.Item, new JsonSerializerOptions() { MaxDepth = 32, WriteIndented = true});
var hircAsString = JsonSerializer.Serialize((object)selectedNode.Item, new JsonSerializerOptions() { MaxDepth = 32, WriteIndented = true});
{
"AkBankSourceData": {
"PluginId": 262145,
"PluginId_type": 1,
"PluginId_company": 0,
"StreamType": 0,
"akMediaInformation": {
"SourceId": 378298469,
"uInMemoryMediaSize": 12089,
"uSourceBits": 0
},
"uSize": 0
},
"NodeBaseParams": {
"NodeInitialFxParams": {
"bIsOverrideParentFX": 0,
"bitsFXBypass": 0,
"FxList": []
},
"bOverrideAttachmentParams": 0,
"OverrideBusId": 0,
"DirectParentID": 0,
"byBitVector": 0,
"NodeInitialParams": {
"AkPropBundle0": {},
"AkPropBundle1": {}
},
"PositioningParams": {
"uBitsPositioning": 0,
"uBits3d": 0,
"ePathMode": 0,
"TransitionTime": 0,
"VertexList": [],
"PlayListItems": [],
"Params": []
},
"AuxParams": {
"byBitVector": 0,
"auxID0": 0,
"auxID1": 0,
"auxID2": 0,
"auxID3": 0,
"reflectionsAuxBus": 0
},
"AdvSettingsParams": {
"byBitVector": 16,
"eVirtualQueueBehavior": 1,
"u16MaxNumInstance": 0,
"eBelowThresholdBehavior": 1,
"byBitVector2": 4
},
"StateChunk": {
"StateChunks": [],
"StateProps": []
},
"InitialRTPC": {
"RTPCList": []
},
"eGroupType": 0,
"ulGroupID": 0,
"ulDefaultSwitch": 0,
"bIsContinuousValidation": 0
},
"OwnerFile": "wwise\\audio\\simplebnkproject.bnk",
"IndexInFile": 0,
"HasError": false,
"Type": 2,
"Size": 84,
"Id": 3990607256
}
{
"AkBankSourceData": {
"PluginId": 262145,
"PluginId_type": 1,
"PluginId_company": 0,
"StreamType": 0,
"akMediaInformation": {
"SourceId": 378298469,
"uInMemoryMediaSize": 12089,
"uSourceBits": 0
},
"uSize": 0
},
"NodeBaseParams": {
"NodeInitialFxParams": {
"bIsOverrideParentFX": 0,
"bitsFXBypass": 0,
"FxList": []
},
"bOverrideAttachmentParams": 0,
"OverrideBusId": 0,
"DirectParentID": 0,
"byBitVector": 0,
"NodeInitialParams": {
"AkPropBundle0": {},
"AkPropBundle1": {}
},
"PositioningParams": {
"uBitsPositioning": 0,
"uBits3d": 0,
"ePathMode": 0,
"TransitionTime": 0,
"VertexList": [],
"PlayListItems": [],
"Params": []
},
"AuxParams": {
"byBitVector": 0,
"auxID0": 0,
"auxID1": 0,
"auxID2": 0,
"auxID3": 0,
"reflectionsAuxBus": 0
},
"AdvSettingsParams": {
"byBitVector": 16,
"eVirtualQueueBehavior": 1,
"u16MaxNumInstance": 0,
"eBelowThresholdBehavior": 1,
"byBitVector2": 4
},
"StateChunk": {
"StateChunks": [],
"StateProps": []
},
"InitialRTPC": {
"RTPCList": []
},
"eGroupType": 0,
"ulGroupID": 0,
"ulDefaultSwitch": 0,
"bIsContinuousValidation": 0
},
"OwnerFile": "wwise\\audio\\simplebnkproject.bnk",
"IndexInFile": 0,
"HasError": false,
"Type": 2,
"Size": 84,
"Id": 3990607256
}
3 Replies
The definition of the NodeInitialParams class
public class NodeInitialParams
{
public AkPropBundle AkPropBundle0 { get; set; }
public AkPropBundleMinMax AkPropBundle1 { get; set; }
}
public class AkPropBundle
{
public class AkPropBundleInstance
{
public AkPropBundleType Type { get; set; }
public float Value { get; set; }
}
public List<AkPropBundleInstance> Values = new List<AkPropBundleInstance>();
}
public class AkPropBundleMinMax
{
public class AkPropBundleInstance
{
public AkPropBundleType Type { get; set; }
public float Min { get; set; }
public float Max { get; set; }
}
public List<AkPropBundleInstance> Values = new List<AkPropBundleInstance>();
}
public class NodeInitialParams
{
public AkPropBundle AkPropBundle0 { get; set; }
public AkPropBundleMinMax AkPropBundle1 { get; set; }
}
public class AkPropBundle
{
public class AkPropBundleInstance
{
public AkPropBundleType Type { get; set; }
public float Value { get; set; }
}
public List<AkPropBundleInstance> Values = new List<AkPropBundleInstance>();
}
public class AkPropBundleMinMax
{
public class AkPropBundleInstance
{
public AkPropBundleType Type { get; set; }
public float Min { get; set; }
public float Max { get; set; }
}
public List<AkPropBundleInstance> Values = new List<AkPropBundleInstance>();
}
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
ah, did not know that (and missed it while looking for the error)
Thanks for pointing it out!