Altamash Shaikh Altamash Shaikh - 4 months ago 9
JSON Question

Can someone help me with creating below JSON in java

Can i get any api's available to convert json to java object?

{
"trigger":
{
"name": "new user2",

"input":
{
"auth": "EaIv0NlXiDWJrpvLkAdP",
"domain": "rangersrockerz"
}
}
}

Answer
JsonObject inputObject=new JsonObject();
JsonObject triggerObject=new JsonObject();
JsonObject mainObject=new JsonObject();
try{
   inputObject.put("auth","EaIv0NlXiDWJrpvLkAdP");
   inputObject.put("domain","rangersrockerz");

   triggerObject.put("input",inputObject);
   triggerObject.put("name","new user2");

   mainObject.put("trigger",triggerObject);

} catch(Exception e){
}
Comments