I am new to rest assured and trying to pass the following body in the post request.
JSON Payload :
{
"apikey": "****",
"collectortoken": "***",
"medium": "*",
"uniquekey": "tcode",
"contacts": [{
"email": "[email protected]",
"tcode": "2597566"
},
{
"tcode": "9990"
}
]
}
I even had tried the following code:
JSONObject obj = new JSONObject();
obj.put("apikey", "****");
obj.put("collectortoken", "***");
obj.put("medium", "2");
obj.put("uniquekey", "tcode");
obj.put("contacts", Arrays.asList(new LinkedHashMap<String, String>() {
{
put("email",name);
put("tcode",tcode);
}
{
put("tcode",tcode);
}
Can someone help me on this.
Thanks