private void testObjectGraph (TestMapGraph object, String typeName) { Json json = new Json(); json.setTypeName(typeName); json.setUsePrototypes(false); json.setIgnoreUnknownFields(true); json.setOutputType(OutputType.json); String text = json.prettyPrint(object); TestMapGraph object2 = json.fromJson(TestMapGraph.class, text); if (object2.map.size() != object.map.size()) { throw new RuntimeException("Too many items in deserialized json map."); } if (object2.objectMap.size != object.objectMap.size) { throw new RuntimeException("Too many items in deserialized json object map."); } if (object2.arrayMap.size != object.arrayMap.size) { throw new RuntimeException("Too many items in deserialized json map."); } }
private static AseFormat fromJson(FileHandle jsonFile) { final Json json = new Json(); json.setIgnoreUnknownFields(true); return json.fromJson(AseFormat.class, jsonFile); }
private static AseFormat fromJson(FileHandle jsonFile) { final Json json = new Json(); json.setIgnoreUnknownFields(true); return json.fromJson(AseFormat.class, jsonFile); }
jj.setIgnoreUnknownFields(true); nodeList = jj.fromJson(List.class, ObjectData.class, json);
public void loadGameState(FileHandle savedFile) throws IOException { EngineLogger.debug("LOADING GAME STATE"); if (savedFile.exists()) { JsonValue root = new JsonReader().parse(savedFile.reader("UTF-8")); Json json = new BladeJson(w, Mode.STATE); json.setIgnoreUnknownFields(true); read(json, root); } else { throw new IOException("LOADGAMESTATE: no saved game exists"); } }
public JsonArtemisSerializer(World world) { super(world); componentCollector = new ComponentCollector(world); referenceTracker = new ReferenceTracker(world); lookup = new ComponentLookupSerializer(); intBagEntitySerializer = new IntBagEntitySerializer(world); entitySerializer = new EntitySerializer(world, referenceTracker); transmuterEntrySerializer = new TransmuterEntrySerializer(); json = new Json(JsonWriter.OutputType.json); json.setIgnoreUnknownFields(true); json.setSerializer(SaveFileFormat.ComponentIdentifiers.class, lookup); json.setSerializer(Bag.class, new EntityBagSerializer(world)); json.setSerializer(IntBag.class, intBagEntitySerializer); json.setSerializer(Entity.class, entitySerializer); json.setSerializer(ArchetypeMapper.class, new ArchetypeMapperSerializer()); json.setSerializer(ArchetypeMapper.TransmuterEntry.class, transmuterEntrySerializer); }
jj.setIgnoreUnknownFields(true); nodeList = jj.fromJson(List.class, ObjectData.class, json);