LibGDX:将新值放入json



我使用JsonReaderJsonValue,如下所示:

JsonReader json = new JsonReader();
JsonValue jsonValue = json.parse(Gdx.files.internal("file.json"));

我的问题是如何向jsonValue添加新项目或更新值?

我找到了解决方案:

jsonValue.remove("name");
jsonValue.addChild("name", new JsonValue("new Value"));

最新更新