i am new to java and json and hence looking for your help. -i want to create a new json file provided few values should be taken from template(json).lets say i have json template as mentioned below. i want to extract what ever is there in step array .i.e step1 and step2. and this value should be put in new json.
problem i am facing 1)how to create nested json using jackson. i am using
JsonFactory factory = new JsonFactory();
JsonGenerator generator = factory.createGenerator(new File("data/output.json"), JsonEncoding.UTF8);
generator.writeStartObject();
generator.writeObjectField("ABC","abc");
generator.writeEndObject();
generator.close();
but this will create a simple json ,not a nested json. i want nested json.
2)i want to extract step array and pass this to newly created json
i checked for this in stackoverflow ,found so many answers but those didnt help me. Hope some1 will help me.
json:
{
"abc": "ryhey0",
"shgsh": "jsdj",
"fgjf": [
{
"type": "int",
"steps": [
{
"type": "step1",
"outputTypes": "int"
},
{
"type": "step2",
"outputTypes": "bool"
}
]
}
]
}