Json基礎
-------------
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
public class JsonReadToString {
public static void main(String[] args) throws Exception {
String json = "{"
+ "\"created_at\":\"Thu Apr 06 15:24:15 +0000 2017\", "
+ "\"id\": 850006245121695744, "
+ "\"text\": \"ツイート\""
+ "}";
ObjectMapper mapper = new ObjectMapper();
JsonNode node = mapper.readTree(json);
System.out.println(node.get("id").longValue()); // → 850006245121695744
System.out.println(node.get("text").textValue()); // → "ツイート"
System.out.println(node.get("created_at").textValue()); // → "Thu Apr 06 15:24:15 +0000 2017"
}
}