首页 > 解决方案 > LibGDX:为 json 赋予新的价值

问题描述

我正在使用JsonReaderJsonValue如下所示:

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

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

标签: libgdx

解决方案


我找到了解决方案:

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

推荐阅读