I am parsing json file and I have one attribute which is coming for twice. So I want to drop one the attribute and so I can avoid ambiguous error. Here is the sample json. For example, address1 and Address1 has same value but only difference is first char is Capital letter. So I want to remove one of them from the json parsing in spark scala.
{
"ID": 1,
"case": "12",
"addresses": {
"": [{
"address1": "abc",
"address2": "bkc",
"Address1": "abc",
"Address2": "bk"
}, {
"address1": "ede",
"address2": "ak",
"Address1": "ede",
"Address2": "ak"
}]
},
"FirstName": "abc",
"LastName": "cvv"
}
Could some one guide me how to remove one of them while we are doing json parsing in spark scala. I need to automate this that means now we are facing issue with address and in future some other attributes may be similar issue. So instead of hard coding it, we may need to look for the solution for all the cases where we are facing similar issue.
""this is not a valid property name in json syntax. You can try to parse the given json with spark as shown here stackoverflow.com/questions/38271611/…. Spark will ignore it since a empty name is not allowed