stackoverflow member i need some help from you.
I am having a JsonObject given below
{
"Id": null,
"Name": "New Task",
"StartDate": "2010-03-05T00:00:00",
"EndDate": "2010-03-06T00:00:00",
"Duration": 1,
"DurationUnit": "d",
"PercentDone": 60,
"ManuallyScheduled": false,
"Priority": 1,
"parentId": null,
"index": 2,
"depth": 1,
"checked": null }
我得到的parentId为null.我想将parentId值从null替换为0.
I am trying to do it with below mentioned code
if(jsonObject.get("parentId") == null || jsonObject.get("parentId") == "")
{
System.out.println("inside null");
jsonObject.put("parentId", 0);
}
else
{
System.out.println("inside else part");
//jsonObject.put("parentId", jsonObject.getInt("parentId"));
jsonObject.put("parentId", 0);
}
but it seems not to be working. What I am doing wrong here.