我使用JsonReader
和JsonValue
,如下所示:
JsonReader json = new JsonReader();
JsonValue jsonValue = json.parse(Gdx.files.internal("file.json"));
我的问题是如何向jsonValue
添加新项目或更新值?
我找到了解决方案:
jsonValue.remove("name");
jsonValue.addChild("name", new JsonValue("new Value"));