import com.fasterxml.jackson.annotation.JsonAutoDetect; import com.fasterxml.jackson.databind.ObjectMapper; import java.io.IOException; import java.io.StringReader; import java.io.StringWriter; @JsonAutoDetect public class AlexeiIvanych { public String name; public int age; public String profession; AlexeiIvanych(){} public static void main(String[] args) throws IOException { /*AlexeiIvanych AlexeiIvanych = new AlexeiIvanych(); AlexeiIvanych.name = "Alexei Ivanych"; AlexeiIvanych.age = 17; AlexeiIvanych.profession = "1C Guru"; ObjectMapper objectMapper = new ObjectMapper(); StringWriter string = new StringWriter(); objectMapper.writeValue(string, AlexeiIvanych); String result = string.toString(); System.out.println(result); */ String jsonString = "{\"name\":\"alexei Ivanych\",\"age\":17,\"profession\":\"1C Guru\"}"; StringReader stringReader = new StringReader(jsonString); ObjectMapper mapper = new ObjectMapper(); AlexeiIvanych alexeiIvanych = mapper.readValue(stringReader, AlexeiIvanych.class); System.out.println(alexeiIvanych); } }