List of usage examples for com.fasterxml.jackson.databind ObjectMapper readValue
@SuppressWarnings("unchecked") public <T> T readValue(byte[] src, JavaType valueType) throws IOException, JsonParseException, JsonMappingException
From source file:org.mule.modules.rest.model.LeagueTransformers.java
@Transformer(sourceMimeType = "application/json") public League fromJson(String json) throws IOException { ObjectMapper mapper = new ObjectMapper(); return mapper.readValue(json, League.class); }
From source file:codes.thischwa.c5c.requestcycle.response.mode.JacksonTest.java
@Test public void testReadValue() throws JsonParseException, JsonMappingException, IOException { String str = "{'test name': 'test', 'value': 'val'}".replace("'", "\""); Map<String, Object> objs = new HashMap<>(); ObjectMapper mapper = new ObjectMapper(); objs = mapper.readValue(str, new TypeReference<Map<String, Object>>() { });/*from w ww . ja v a 2 s. c om*/ assertEquals("test", objs.get("test name")); }
From source file:com.alzatezabala.fp.presentacion.json.JSONConverterImplJackson.java
@Override public Object fromJSON(String json, Class clazz) { try {/* w w w .j a va2 s .c o m*/ ObjectMapper objectMapper = new ObjectMapper(); return objectMapper.readValue(json, clazz); } catch (IOException ex) { throw new RuntimeException(ex); } }
From source file:com.kinvey.business_logic.KinveyAppMetadataTest.java
@Before public void setUp() throws Exception { File file = FileUtils.getFile("src", "test", "resources", "Request_CollectionArguments.json"); ObjectMapper mapper = new ObjectMapper(); request = mapper.readValue(file, new TypeReference<Request<CollectionArguments>>() { });//from w w w. j a v a2s . c o m }
From source file:com.proofpoint.http.client.TestSmileBodyGenerator.java
@Override protected Object decodeBody(byte[] body) throws Exception { ObjectMapper mapper = new ObjectMapper(new SmileFactory()); return mapper.readValue(body, Object.class); }
From source file:com.fpmislata.banco.presentation.Json.Impl.JsonTransformerImplJackson.java
@Override public <T> T fromJsonToObject(String json, Class<T> clazz) { try {//from w ww . j a v a2 s .c om ObjectMapper objectMapper = new ObjectMapper(); return objectMapper.readValue(json, clazz); } catch (IOException ex) { throw new RuntimeException(ex); } }
From source file:es.cursohibernate.spring.json.JsonTransformerImplJackson.java
@Override public Object fromJson(String json, Class clazz) { try {//from ww w . j a v a 2s. c o m ObjectMapper objectMapper = new ObjectMapper(); return objectMapper.readValue(json, clazz); } catch (IOException ex) { throw new RuntimeException(ex); } }
From source file:pl.edu.pwr.iiar.zak.thermalKit.parser.RcFileParser.java
public RcFileParser() throws IOException, InterruptedException { File rcFile = new File(String.format("/home/%s/.jgenerilorc", System.getenv().get("USER"))); ObjectMapper mapper = new ObjectMapper(); node = mapper.readValue(rcFile, JsonNode.class); }