If we have a POJO class, then we can map it with some incoming JSON. I am struggling to find out a way by which I can just have all plain json value inside.
For ex.
{
"macro_tasks": [
{
"id": "cc5cee68-c1e5-4396-987b-c68559399186",
"label": "consi-1",
"name": "Consi 1",
"project_id": "82d1e463-1bb1-42d3-9adc-9e0d5848d139",
"creator_id": null,
"created_at": null,
"updated_at": null,
"meta_data": {
"key1": "value1",
"key2": 321
}
}
]
}
Here meta_data
is of JSON type which can keep changing its values inside. So I cannot map it with some POJO class.
public class MacroTask {
private UUID id;
private String label;
private String name;
private UUID projectId;
private UUID creatorId;
private String createdAt;
private String updatedAt;
private <some data type> meta_data;
//getter and setter
Is there any way to get plain JSON data and use it in code and dump into DB [we are using PostgreSQL, which supports jsonb
type.]