input:
{
"First Name": "XX",
"Middle Name": "",
"Last Name": "XX",
"Date of Birth": "11/12/2013",
"Address": "XXX",
"Village": "XXX",
"Pincode": "34234"
"License Number": "1234567890"
}
output:
{
"First Name": "XX",
"Middle Name": "",
"Last Name": "XX",
"Date of Birth": "11/12/2013",
"Address":
{
"Village": "XXX",
"Pincode": "34234"
}
"License Number": "1234567890"
}
Hi ,
I have the above input json and I plan to generate this kind of output json. Similar kind of use cases.
Now I want to generate one json schema for each use case using sample output json.
With the help of Java, I would like to dynamically pick the values and prepare the output format as expected.
Anyone achieved similar kind of job ?
input:
{
"First Name": "XX",
"Middle Name": "",
"Last Name": "XX",
"Date of Birth": "11/12/2013",
"Address": "XXX",
"Village": "XXX",
"Pincode": "34234"
"License Number": "1234567890"
}
output:
{
"First Name": "XX",
"Middle Name": "",
"Last Name": "XX",
"Date of Birth": "11/12/2013",
"Address":
{
"Village": "XXX",
"Pincode": "34234"
}
"License Number": "1234567890"
}
Hi ,
I have the above input json and I plan to generate this kind of output json. Similar kind of use cases.
Now I want to generate one json schema for each use case using sample output json.
With the help of Java, I would like to dynamically pick the values and prepare the output format as expected.
Anyone achieved similar kind of job ??
2
Answers
To get the output that you want you muste create a custom class which has the attributes, like that:
Class
Address
Then the Class which contains all
CustomData
, like that:TEST:
OUTPUT:
Try it and let me know.
You may try to use JSON libraries with query, transform and restructure capability such as Josson.
https://github.com/octomix/josson
Output