My Json looks something like this:
{
"source": "somedatabasename",
"lisofobjects": [{
"data": {
"starttime": "145756767377",
"age": "20",
"name": "xyz"
}
}]
}
As a part of validation of my API I want to pass string in age attribute for example age: "xyz". I have created a POJO objects and parsing json using gson.I want to know how should I setvalueof age at runtime.So my request code looks like this:
protected RequestSpecification abc(classnamefromwherejsonisparsed object)
throws JsonSyntaxException, FileNotFoundException, IOException {
RequestSpecBuilder builder = new RequestSpecBuilder();
builder.setContentType(ContentType.JSON);
builder.setBody(object.toJson(object.getallTestData()));
Thus here with getallTestData I want to change only 1 value for example age here. something like object.setAge("abc")