Back to project page wizapp.
The source code is released under:
MIT License
If you think the Android project wizapp listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.wb.wizapp.rest; /*from w w w .j a va 2 s . c om*/ import org.json.JSONException; import org.json.JSONObject; import android.util.Log; import com.google.gson.Gson; import com.wb.wizapp.IConstants; public abstract class JsonBean implements IJsonParsable { private JSONObject toJson() { JSONObject json = null; try { Gson gson = new Gson(); json = new JSONObject(gson.toJson(this)); } catch (JSONException e) { Log.e(IConstants.LOG_TAG, "bad json parsable object:" + this.getClass().getName(), e); } return json; } public String toJsonString() { JSONObject json = toJson(); if (json != null) { return toJson().toString(); } else { return null; } } }