Created
December 15, 2017 05:32
-
-
Save ddbj-repo/324515b540e438c23e5589dfa40f9aed to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.LinkedHashMap; | |
import org.springframework.util.LinkedMultiValueMap; | |
import org.springframework.util.MultiValueMap; | |
import org.springframework.web.client.RestTemplate; | |
import org.springframework.web.client.HttpClientErrorException; | |
import net.arnx.jsonic.JSON; | |
/* | |
* (中略) | |
*/ | |
MultiValueMap<String, String> parts = new LinkedMultiValueMap<String, String>(); | |
parts.add("format", "json"); | |
RestTemplate rest = new RestTemplate(); | |
String response = rest.getForObject("http://ddbj.nig.ac.jp/wabi/blast/help/list_result", String.class, parts); | |
/* | |
---- response の例 (ここから) -------------------------------- | |
{ | |
"result": [ | |
"www", | |
"mail" | |
] | |
} | |
---- response の例 (ここまで) -------------------------------- | |
*/ | |
LinkedHashMap<String, Object> result = JSON.decode(response, LinkedHashMap.class); | |
String result0 = (List<String>)result.get(0); | |
/* | |
* 例: | |
* result.size() == 2 | |
* result0 == "www" | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment