I'm getting log files from AWS CloudTrail. For the most part, they are consistent, but some properties take different forms. For example:
{
...
requestParameters: {
repositoryName: "Test",
branchName: "master"
},
...
}
while other times I get something like:
{
...
requestParameters: {
encryptionContext: {
aws:codecommit:env-alg: "AES/256",
aws:codecommit:sig-alg: "HmacSHA256/256",
aws:codecommit:id: "117a18c1-4b40-489f-af07-da1ecd36eccf"
},
"someotherkey" : "key"
},
...
}
So this isn't really a specific AWS question, though others may have tackled this with CloudTrail already. What is the best way to take these provided JSON strings and convert them into .NET objects? Is something like the following the best way?
public class CloudTrailRecord
{
...
public string EventId { get; set; }
public Dictionary<string, dynamic> RequestParameters { get; set; }
...
}
Or is there a way to just capture the requestParameters data as string data regardless of how it is provided?