Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ddbj-repo/324515b540e438c23e5589dfa40f9aed to your computer and use it in GitHub Desktop.
Save ddbj-repo/324515b540e438c23e5589dfa40f9aed to your computer and use it in GitHub Desktop.
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