You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The json contains an array called "AdditionalClaimant" which sometimes has value but also can be an empty array. I need to convert this to csv using ChoETL where the claimantFirstName values in the array should merge to one column ("Olga,Meera"). and this is my code
//Use ChoETL to convert data to CSV
using (var r = ChoJSONReader.LoadText(attorneyClaimData)
.WithField("Fire", jsonPath: "$.incident.name", isArray: false)
.WithField("FirstName", jsonPath: "$.additionalClaimant[*].claimantFirstName", defaultValue: "null")
)
{
using (var w = new ChoCSVWriter("AttorneyClaims.csv")
.WithFirstLineHeader()
.UseNestedKeyFormat(false)
.Configure(c => c.ArrayValueSeparator = ';')
)
{
w.Write(r);
}
}
The problem arises when the AdditionalClaimant array is empty. I hit the error as below
"message": "Failed to write 'System.Object[]' value for 'FirstName' field."
Please can you help around how to navigate around this?
The text was updated successfully, but these errors were encountered:
I have data in json similar to the structure below:
The json contains an array called "AdditionalClaimant" which sometimes has value but also can be an empty array. I need to convert this to csv using ChoETL where the claimantFirstName values in the array should merge to one column ("Olga,Meera"). and this is my code
The problem arises when the AdditionalClaimant array is empty. I hit the error as below
"message": "Failed to write 'System.Object[]' value for 'FirstName' field."
Please can you help around how to navigate around this?
The text was updated successfully, but these errors were encountered: