Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

gson parse json

Gson gson = new Gson();

// 1. JSON file to Java object
Object object = gson.fromJson(new FileReader("C:fileName.json"), Object.class);

// 2. JSON string to Java object
String json = "{'name' : 'mkyong'}";
Object object = gson.fromJson(json, Staff.class);
Source by mkyong.com #
 
PREVIOUS NEXT
Tagged: #gson #parse #json
ADD COMMENT
Topic
Name
5+1 =