Code example for Gson

Methods: toJson

0
	 * @return JSON string 
	 * @throws IOException 
	 */ 
	protected String toJson(Object object) throws IOException {
		try { 
			return gson.toJson(object);
		} catch (JsonParseException jpe) {
			IOException ioe = new IOException(
					"Parse exception converting object to JSON"); //$NON-NLS-1$ 
			ioe.initCause(jpe);
			throw ioe;
		} 
	} 
 
	/** 
	 * Parse JSON to specified type 
	 * 
	 * @param <V> 
	 * @param stream 
	 * @param type