@Test public void testDeser4() throws IOException { final ObjectMapper objectMapper = new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); List<MantisJobMetadataView> jobIdInfos = Jackson.fromJSON(objectMapper,"[{\"jobMetadata\":{\"jobId\":\"sine-function-1\",\"name\":\"sine-function\"," + "\"user\":\"nmahilani\",\"submittedAt\":1527703650220,\"jarUrl\":\"https: "\"numStages\":2,\"sla\":{\"runtimeLimitSecs\":0,\"minRuntimeSecs\":0,\"slaType\":\"Lossy\",\"durationType\":\"Perpetual\",\"userProvidedType\":\"\"}," + "\"state\":\"Accepted\",\"subscriptionTimeoutSecs\":0,\"parameters\":[{\"name\":\"useRandom\",\"value\":\"True\"}],\"nextWorkerNumberToUse\":11," + "\"migrationConfig\":{\"strategy\":\"PERCENTAGE\",\"configString\":\"{\\\"percentToMove\\\":25,\\\"intervalMs\\\":60000}\"}," + "\"labels\":[{\"name\":\"_mantis.user\",\"value\":\"nmahilani\"},{\"name\":\"_mantis.ownerEmail\",\"value\":\"nmahilani@netflix.com\"}," + "{\"name\":\"_mantis.jobType\",\"value\":\"other\"},{\"name\":\"_mantis.criticality\",\"value\":\"low\"},{\"name\":\"_mantis.artifact.version\",\"value\":\"0.2.9\"}]}," + "\"stageMetadataList\":[{\"jobId\":\"sine-function-1\",\"stageNum\":0,\"numStages\":2,\"machineDefinition\":{\"cpuCores\":1.0,\"memoryMB\":200.0,\"networkMbps\":128.0,\"diskMB\":1024.0,\"numPorts\":1}," + "\"numWorkers\":1,\"hardConstraints\":null,\"softConstraints\":null,\"scalingPolicy\":null,\"scalable\":false}," + "{\"jobId\":\"sine-function-1\",\"stageNum\":1,\"numStages\":2,\"machineDefinition\":{\"cpuCores\":1.0,\"memoryMB\":200.0,\"networkMbps\":128.0,\"diskMB\":1024.0,\"numPorts\":1},\"numWorkers\":1,\"hardConstraints\":[],\"softConstraints\":[\"M4Cluster\"]," + "\"scalingPolicy\":{\"stage\":1,\"min\":1,\"max\":10,\"increment\":2,\"decrement\":1,\"coolDownSecs\":600," + "\"strategies\":{\"CPU\":{\"reason\":\"CPU\",\"scaleDownBelowPct\":15.0,\"scaleUpAbovePct\":75.0,\"rollingCount\":{\"count\":12,\"of\":20}}},\"enabled\":true},\"scalable\":true}]," + "\"workerMetadataList\":[{\"workerIndex\":0,\"workerNumber\":2,\"jobId\":\"sine-function-1\",\"stageNum\":0,\"numberOfPorts\":4,\"metricsPort\":0,\"consolePort\":0," + "\"debugPort\":-1,\"ports\":[],\"state\":\"Accepted\",\"slave\":null,\"slaveID\":null,\"cluster\":{\"present\":false},\"acceptedAt\":1527703650231,\"launchedAt\":0,\"startingAt\":0,\"startedAt\":0," + "\"completedAt\":0,\"reason\":null,\"resubmitOf\":-1,\"totalResubmitCount\":0},{\"workerIndex\":0,\"workerNumber\":3,\"jobId\":\"sine-function-1\",\"stageNum\":1,\"numberOfPorts\":4,\"metricsPort\":0,\"consolePort\":0,\"debugPort\":-1,\"ports\":[],\"state\":\"Accepted\"," + "\"slave\":null,\"slaveID\":null,\"cluster\":{\"present\":false},\"acceptedAt\":1527703650232,\"launchedAt\":0,\"startingAt\":0,\"startedAt\":0,\"completedAt\":0," + "\"reason\":null,\"resubmitOf\":-1,\"totalResubmitCount\":0}]}]", new TypeReference<List<MantisJobMetadataView>>() { }); System.out.println(jobIdInfos); MantisWorkerMetadataWritable mwm = jobIdInfos.get(0).getWorkerMetadataList().get(0); mwm.setCluster(Optional.ofNullable("test")); System.out.println(objectMapper.writer(Jackson.DEFAULT_FILTER_PROVIDER).writeValueAsString(mwm)); }
public static <T> T fromJSON( ObjectMapper mapper, String json, TypeReference<T> expectedType) throws IOException { return mapper.readerFor(expectedType).readValue(json); }
Jackson { public static <T> T fromJSON( ObjectMapper mapper, String json, TypeReference<T> expectedType) throws IOException { return mapper.readerFor(expectedType).readValue(json); } }
Jackson { public static <T> T fromJSON( ObjectMapper mapper, String json, TypeReference<T> expectedType) throws IOException { return mapper.readerFor(expectedType).readValue(json); }  }
Jackson { public static <T> T fromJSON( ObjectMapper mapper, String json, TypeReference<T> expectedType) throws IOException { return mapper.readerFor(expectedType).readValue(json); }  static Marshaller<T, RequestEntity> marshaller(); static Marshaller<T, RequestEntity> marshaller(FilterProvider filterProvider); static Marshaller<T, RequestEntity> marshaller(ObjectMapper mapper); static Marshaller<T, RequestEntity> marshaller(
            ObjectMapper mapper,
            FilterProvider filterProvider); static Unmarshaller<HttpEntity, T> unmarshaller(Class<T> expectedType); static Unmarshaller<HttpEntity, T> unmarshaller(TypeReference<T> expectedType); static Unmarshaller<HttpEntity, T> unmarshaller(
            ObjectMapper mapper,
            Class<T> expectedType); static Unmarshaller<HttpEntity, T> unmarshaller(
            ObjectMapper mapper,
            TypeReference<T> expectedType); static T fromJSON(
            ObjectMapper mapper,
            String json,
            TypeReference<T> expectedType); static T fromJSON(
            ObjectMapper mapper,
            String json,
            Class<T> expectedType); static T fromJSON(String json, Class<T> expectedType); static T fromJSON(String json, TypeReference<T> expectedType); static String toJson(Object object); }
Jackson { public static <T> T fromJSON( ObjectMapper mapper, String json, TypeReference<T> expectedType) throws IOException { return mapper.readerFor(expectedType).readValue(json); }  static Marshaller<T, RequestEntity> marshaller(); static Marshaller<T, RequestEntity> marshaller(FilterProvider filterProvider); static Marshaller<T, RequestEntity> marshaller(ObjectMapper mapper); static Marshaller<T, RequestEntity> marshaller(
            ObjectMapper mapper,
            FilterProvider filterProvider); static Unmarshaller<HttpEntity, T> unmarshaller(Class<T> expectedType); static Unmarshaller<HttpEntity, T> unmarshaller(TypeReference<T> expectedType); static Unmarshaller<HttpEntity, T> unmarshaller(
            ObjectMapper mapper,
            Class<T> expectedType); static Unmarshaller<HttpEntity, T> unmarshaller(
            ObjectMapper mapper,
            TypeReference<T> expectedType); static T fromJSON(
            ObjectMapper mapper,
            String json,
            TypeReference<T> expectedType); static T fromJSON(
            ObjectMapper mapper,
            String json,
            Class<T> expectedType); static T fromJSON(String json, Class<T> expectedType); static T fromJSON(String json, TypeReference<T> expectedType); static String toJson(Object object); static final SimpleFilterProvider DEFAULT_FILTER_PROVIDER; }