Last active
March 11, 2020 09:02
-
-
Save koduki/f848e3efa8fec95a1c823b15d627929d to your computer and use it in GitHub Desktop.
JSON文字列をList+HashMapに変換するコード。他言語に比べてちょっと冗長なのでメモ。
This file contains hidden or 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 com.fasterxml.jackson.databind.ObjectMapper; | |
import com.fasterxml.jackson.core.type.TypeReference; | |
var json = "[{\"name\":\"nanoha\", \"age\":10}, {\"name\":\"fate\", \"age\":10}]"; | |
var mapper = new ObjectMapper(); | |
var data = Arrays.asList(mapper.readValue(json, HashMap[].class)); | |
System.out.println(data); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment