Search
 
SCRIPT & CODE EXAMPLE
 

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);
Comment

gson parse json

Gson gson = new Gson();

// 1. Java object to JSON file
gson.toJson(obj, new FileWriter("C:fileName.json"));

// 2. Java object to JSON string
String json = gson.toJson(obj);
Comment

PREVIOUS NEXT
Code Example
Java :: += in java 
Java :: char to charsequence in java 
Java :: java lambda function 
Java :: java check if class is subclass 
Java :: java method exercises 
Java :: multiple return values in function java 
Java :: camel java 
Java :: Get the number of weeks between two dates 
Java :: find power of number in method java 
Java :: composite design pattern 
Java :: how to sprint minecraft java 
Java :: how to import borderlayout 
Java :: get the logged in user java 
Java :: x = x + y; in java 
Java :: java in 5 minutes 
Java :: print prime numbers in java 
Java :: devoluciones redsys api 
Sql :: conda install sqlalchemy 
Sql :: postgres get running query 
Sql :: mysql add user with all privileges 
Sql :: sql add column after another 
Sql :: view column data type sql 
Sql :: how to get yesterday date in mysql 
Sql :: postgresql calculate age from birthdate 
Sql :: oracle kill session 
Sql :: mysql add column if not exists 
Sql :: sql last row in table 
Sql :: get year from date postgres 
Sql :: no data found oracle 
Sql :: mysql import gzip db 
ADD CONTENT
Topic
Content
Source link
Name
5+5 =