質問するログイン新規登録

質問編集履歴

3

回答を反映しました。

2021/01/23 11:03

投稿

yuyu213
yuyu213

スコア17

title CHANGED
File without changes
body CHANGED
@@ -78,16 +78,16 @@
78
78
 
79
79
 
80
80
  public class PostalCodeService {
81
+ public static void main(String[] args) throws JsonParseException, JsonMappingException, IOException {
81
- Response response;
82
+ Response response = new Response();
82
83
 
83
- public static void main(String[] args) throws JsonParseException, JsonMappingException, IOException {
84
84
  ObjectMapper mapper = new ObjectMapper();
85
85
  mapper.registerModule(new JavaTimeModule());
86
86
  mapper.configure(DeserializationFeature.ADJUST_DATES_TO_CONTEXT_TIME_ZONE, false);
87
87
 
88
88
  URL url = new URL("http://geoapi.heartrails.com/api/json?method=searchByPostal&postal=0010010");
89
89
 
90
- PostalCodeService hoge = mapper.readValue(url, PostalCodeService.class);
90
+ response = mapper.readValue(url, Response.class);
91
91
  // System.out.println(mapper.readValue(url, PostalCodeService.class));
92
92
  }
93
93
  }
@@ -99,9 +99,8 @@
99
99
  import java.util.List;
100
100
 
101
101
  public class Response {
102
- Location LocationList;
102
+ public List<Location> location;
103
103
  }
104
-
105
104
  ```
106
105
  LocationList.java
107
106
  ```Java

2

初心者アイコンの追加

2021/01/23 11:03

投稿

yuyu213
yuyu213

スコア17

title CHANGED
File without changes
body CHANGED
@@ -127,5 +127,4 @@
127
127
  public float y;
128
128
  public String postal;
129
129
  }
130
-
131
130
  ```

1

誤字

2021/01/23 09:01

投稿

yuyu213
yuyu213

スコア17

title CHANGED
File without changes
body CHANGED
@@ -92,10 +92,6 @@
92
92
  }
93
93
  }
94
94
  ```
95
- PostalCodeService.java
96
- ```Java
97
-
98
- ```
99
95
  Response.java
100
96
  ```Java
101
97
  package com.tiscon.service;