package com.imooc.utils;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;

public class GsonUtil {

	private static Gson gson = null;

	private GsonUtil() {
	}

	static {
		gson = new GsonBuilder().create();
	}

	public static String beanToJson(Object value) {
		return gson.toJson(value);
	}

	public static <T> T jsonToBean(String content, Class<T> valueType) {
		return gson.fromJson(content, valueType);
	}
}
