serializing and deserializing JSON data to Java objects and vice-versa.
-jackson 도있다 .
Array Examples
Gson gson = new Gson();
int[] ints = {1, 2, 3, 4, 5};
String[] strings = {"abc", "def", "ghi"};
// Serialization
gson.toJson(ints); // ==> [1,2,3,4,5]
gson.toJson(strings); // ==> ["abc", "def", "ghi"]
// Deserialization
int[] ints2 = gson.fromJson("[1,2,3,4,5]", int[].class);
// ==> ints2 will be same as ints
Map
Map<String,String> result=(Map<String,String>)gson.fromJson(gson.toJson(result),Map.class);
넣을땐다 to json
특정요소 get
element.getAsJsonObject().get("user_re_passwd").getAsString()
배열도 가능한게 장점 !
'Api > Google api' 카테고리의 다른 글
com.google.android.gms.common.api.ApiException: 12500 (0) | 2019.06.28 |
---|---|
Google Maps Android Api (0) | 2019.05.14 |