Code example for Gson

Methods: toJson

0
 
			RemoteService<HeroProfile> heroService = serviceFactory
					.getService(HeroProfile.class); 
			HeroProfile heroProfile = heroService.receiveEntity(configuration);
 
			Gson g = new Gson();
			String json = g.toJson(heroProfile);
			System.out.println("gson:" + json);
 
			String value = heroProfile.getItems().getBracers().getName();
			System.out.println(value);
		} catch (D3ServerCommunicationException e) {
			System.out.println("Error during accessing hero profile: "
					+ e.getErrorEntity().getCode() + " - "
					+ e.getErrorEntity().getReason());
		} 
 
	} 
}