APISonar


com.badlogic.gdx.utils.Json.Json

> com > badlogic > gdx > utils > Json > Json
com APIs badlogic APIs gdx APIs utils APIs Json APIs Json APIs

Example 1
public String constructJsonString() {
        String str = "";
        Json json = new Json();
        json.setOutputType(OutputType.json);
        str = json.toJson(this);
        return str;
    }
Example 2
public SaveDataManager(String projectPath) {
        json = new Json();
        fileHandle = Gdx.files.absolute(projectPath + "/tiled_plugin.dt");
        load();
    }
Example 3
public void undoAction() {
        Json json =  new Json();
        CompositeVO compositeVO = json.fromJson(CompositeVO.class, backup);
        Set<Entity> newEntitiesList = PasteItemsCommand.createEntitiesFromVO(compositeVO);

        for (Entity entity : newEntitiesList) {
            Overlap2DFacade.getInstance().sendNotification(MsgAPI.NEW_ITEM_ADDED, entity);
        }

        sandbox.getSelector().setSelections(newEntitiesList, true);
    }
Example 4
public SceneVO getSceneVO(String name) {
        SceneDataManager sceneDataManager = facade.retrieveProxy(SceneDataManager.NAME);
        // TODO: this should be cached
        FileHandle file = Gdx.files.internal(sceneDataManager.getCurrProjectScenePathByName(name));
        Json json = new Json();
        json.setIgnoreUnknownFields(true);
        return json.fromJson(SceneVO.class, file.readString());
    }
Example 5
public static void getChangelog(Consumer<Array<VersionInfo>> success, Consumer<Throwable> fail){
        Net.http(releasesURL, "GET", result -> {
            Json j = new Json();
            Array<JsonValue> list = j.fromJson(null, result);
            Array<VersionInfo> out = new Array<>();
            for(JsonValue value : list){
                String name = value.getString("name");
                String description = value.getString("body").replace("\r", "");
                int id = value.getInt("id");
                int build = Integer.parseInt(value.getString("tag_name").substring(1));
                out.add(new VersionInfo(name, description, id, build));
            }
            success.accept(out);
        }, fail);
    }