I am using .net for api and using system.text.json..
I have two differnt json strings as per below and I want to create one json string from that two strings, like I want to merge both strings in one but it should look like below. I am giving both json strings below and also the one which I am expecting also.. if any can help me..
First json string which I have:
{
"FirstJson": {
"Test1": {
"2020": [
"40%",
"40%",
"40%",
"40%"
],
"2021": [
"50%",
"30%",
"30%",
"40%"
]
},
"Test2": {
"2020": [
"No",
"No",
"No",
"No"
],
"2021": [
"No",
"No",
"No",
"No"
]
}
}
}
Second string which I have:
{
"SecondJson": {
"Test3": [
{
"2020": [
"LC",
"Cd",
"NA",
"LP"
],
"2021": [
"LC",
"Cd",
"NA",
"Lp"
]
},
{
"2020": [
"LC",
"LC",
"LC",
"LC"
],
"2021": [
"Cd",
"Cd",
"Cd",
"Cd"
]
}
]
}
}
Now I want to merge both and want to create one so below is string which I am expecting to create:
{
"FirstJson": {
"Test1": {
"2020": [
"40%",
"40%",
"40%",
"40%"
],
"2021": [
"50%",
"30%",
"30%",
"40%"
]
},
"Test2": {
"2020": [
"No",
"No",
"No",
"No"
],
"2021": [
"No",
"No",
"No",
"No"
]
}
},
"SecondJson": {
"Test3": [
{
"2020": [
"LC",
"Cd",
"NA",
"LP"
],
"2021": [
"LC",
"Cd",
"NA",
"Lp"
]
},
{
"2020": [
"LC",
"LC",
"LC",
"LC"
],
"2021": [
"Cd",
"Cd",
"Cd",
"Cd"
]
}
]
}
}