I am validating output of the GET request with the data stored in the ms sql table using jdbc connection.
I would like to achieve below.
Output of my get request is like below
[
{
"Id1": "9f3da555-136b-461d-a6d6-575c61599896",
"Id2": "96135439-17f5-424c-9285-fc672b0626ac",
"Id3": "da2e6593-381b-452b-9879-e61f5b97f97b",
"Name": "abc",
"name2": "xyz"
},
{
"Id4": "9f3da555-136b-461d-a6d6-575c61599896",
"Id5": "96135439-17f5-424c-9285-fc672b0626ac",
"Id6": "da2e6593-381b-452b-9879-e61f5b97f97b",
"Name": "abc1",
"name2": "xyz1",
"productName":"Amazon",
"ProductFamily":"Mobile"
},
{
"Id7": "9f3da555-136b-461d-a6d6-575c61599896",
"Id8": "96135439-17f5-424c-9285-fc672b0626ac",
"Id9": "da2e6593-381b-452b-9879-e61f5b97f97b",
"Name": "abc3",
"name2": "xyz3",
"productName":"Amazon",
"location":"India"
}
.............}
But my query output is
[
{ "Id1": "9f3da555-136b-461d-a6d6-575c61599896", "Id2": "96135439-17f5-424c-9285-fc672b0626ac", "Id3": "da2e6593-381b-452b-9879-e61f5b97f97b", "Name": "abc", "name2": "xyz" "productName":null, "ProductFamily":null, "location":null }, {
"Id4": "9f3da555-136b-461d-a6d6-575c61599896",
"Id5": "96135439-17f5-424c-9285-fc672b0626ac",
"Id6": "da2e6593-381b-452b-9879-e61f5b97f97b",
"Name": "abc1",
"name2": "xyz1",
"productName":"Amazon",
"ProductFamily":"Mobile",
"location": null
},
{
"Id7": "9f3da555-136b-461d-a6d6-575c61599896",
"Id8": "96135439-17f5-424c-9285-fc672b0626ac",
"Id9": "da2e6593-381b-452b-9879-e61f5b97f97b",
"Name": "abc3",
"name2": "xyz3",
"productName":"Amazon",
"productFamily":null,
"location":"India"
}
.............}
So I am looking for a solution where I can add ProductName, ProductFamily and location in the output of GET API call with value as null if the kay is not present in the object but if it is present like shown above in one of the json object then it should not change that value.
Can someone please guide me.