I have a JSON property file, which is updated by a user manually.
I am mapping it to objects, using Jackson Object mapper:
[
{ "id":"01",
"name":"Joe",
"Children" : [ {"Name" : "Alex",
"Age" : "21"},
{"name" : "David",
"Age" : "1"}
]
},
{ "id":"02",
"name":"Jackson",
"Children" : [ {"Name" : "Mercy",
"Age" : "10"},
{"name" : "Mary",
"Age" : "21"}
]
}
]
Since it is updated manually by a user, they can use any casing; mixed, upper, lower, etc. The solution I have found is, while reading the file I am converting to lower case, like this :
String content = new Scanner(new File("filename")).useDelimiter("\\Z").next();
After this I am mapping to my object using Jackson, which works. I am using lower case member names for the mapped classes. Is it the right approach or is there any other way?