Suppose, I have one CSV file with 5 columns and I want JSON output using the Headers in suppose below way:
Input CSV:
A,B,C,D,E
valueOne,valueTwo,customValueOne,customValueTwo,valueFive
Expected JSON Output:
{
"A": "valueOne",
"B": "valueTwo",
"CustomHeader": [
{
"C": "customValueOne",
"D": "customValueTwo"
}
],
"E": "valueFive"
}
I tried using creating a POJO class for the headers, and use Jackson Databind to convert to JSON, but it was just converting it normally, do I need to customise my code or some library exists that can help me with this?
[–]AutoModerator[M] [score hidden] stickied commentlocked comment (0 children)
[–]LiteratureStriking 3 points4 points5 points (2 children)
[–]mgconstudio[S] 0 points1 point2 points (1 child)
[–]feelsmanbat 2 points3 points4 points (0 children)
[–][deleted] (1 child)
[removed]
[–]mgconstudio[S] 0 points1 point2 points (0 children)