2017년 6월 12일 월요일

5. JAVA로 날씨정보, 대기정보 호출...

1. 날씨정보 분해하기

2. json 사용할 줄 알면 다 하는 그거..

3. jackson 2.8.9 사용함.
public static void parseWeather(String weatherInfo) {
  //System.out.println(weatherInfo);
  try {
   ObjectMapper mapper = new ObjectMapper();
   JsonNode root = mapper.readTree(weatherInfo);
   //System.out.println(root.path("weather"));
   System.out.println(root.path("weather").path("yesterday").get(0).findValue("sky")); //여러 정보가 오지만.. 난 날씨만 필요함
   System.out.println(root.path("result"));
  } catch (JsonProcessingException e1) {
   // TODO Auto-generated catch block
   e1.printStackTrace();
  } catch (IOException e1) {
   // TODO Auto-generated catch block
   e1.printStackTrace();
  }
 }

댓글 없음:

댓글 쓰기

[DOS] ULTIMA 2 클리어

  몰아쓰는 거라.. 포스팅을 또 함.. ​ 울티마를 하려면.. 일단 메뉴얼부터 정독을 하고 뭘해야 할 지를 정한다음 게임을 해야 한다.. ​ 2편 메뉴얼을 보니.. 형편없는 쓰레기게임이구나.. 라는 생각만 든다.. ​ 낭만의 시대적 게임이라.. 정말...