Edit and add. Contents of a JSON file in Java -
so have found few previous topics on how none of them made sense me. wondering if explain how edit , add following:
{ "users": { "account1": { "name": "username1", "id": "user1id", "shown": "do show" }, "acount2": { "name": "username2", "id": "userd2id", "shown": "do show" }, }, "selectedaccount": "account1",
i wish add new account accounts 1 , 2. wish change selectedaccount's value.
any appreciated.
so i'm still needing this, doing:
jsonobject jsonobj = new jsonobject(sb.tostring()); jsonobject profiles = jsonobj.getjsonobject("users"); jsonobject jsonattribute = new jsonobject(); jsonattribute.put("name", "username0"); jsonattribute.put("id", "user0id"); jsonattribute.put("shown", "do show"); jsonobject newprofile = profiles.append(name, jsonattribute); profiles.append("account0", newprofile);
Comments
Post a Comment