有人可以帮我在 java 中创建以下 JSON
Can someone help me with creating below JSON in java
我可以得到任何 api 可用于将 json 转换为 java 对象吗?
{
"trigger":
{
"name": "new user2",
"input":
{
"auth": "EaIv0NlXiDWJrpvLkAdP",
"domain": "rangersrockerz"
}
}
}
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){
}
我可以得到任何 api 可用于将 json 转换为 java 对象吗?
{
"trigger":
{
"name": "new user2",
"input":
{
"auth": "EaIv0NlXiDWJrpvLkAdP",
"domain": "rangersrockerz"
}
}
}
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){
}