I am relatively new to c# and need some guidance. I need to search through a large json array to find duplicate objects and list how many occurrences.
Sample Array
{
"data":
[
{
"date": "20220101",
"someID": "ID1",
"someType1": "SRVC",
"someType2": "SEND"
},
{
"date": "20220101",
"someID": "ID1",
"someType1": "SRVC",
"someType2": "SEND"
},
{
"date": "20220101",
"someID": "ID2",
"someType1": "SRVC",
"someType2": "RECV"
},
{
"date": "20220101",
"someID": "ID2",
"someType1": "SRVC",
"someType2": "RECV"
},
{
"date": "20220101",
"someID": "ID2",
"someType1": "SRVC",
"someType2": "RECV"
},
{
"date": "20220101",
"someID": "ID2",
"someType1": "SRVC",
"someType2": "SEND"
},
{
"date": "20220101",
"someID": "ID2",
"someType1": "SRVC",
"someType2": "SEND"
},
{
"date": "20220101",
"someID": "ID2",
"someType1": "SRVC",
"someType2": "SEND"
}
]
}
I have been able to search through and find duplicate elements but not the complete object. The output should be:
{
"result":
[
{
"date": "20220101",
"someID": "ID1",
"someType1": "SRVC",
"someType2": "SEND",
"objCount": 2
},
{
"date": "20220101",
"someID": "ID2",
"someType1": "SRVC",
"someType2": "RECV",
"objCount": 3
},
{
"date": "20220101",
"someID": "ID2",
"someType1": "SRVC",
"someType2": "SEND",
"objCount": 3
}
]
}
Any help to point me in the right direction would be great. Thanks in advance