Android Open Source - feeligo_android_sdk J S O N Helper






From Project

Back to project page feeligo_android_sdk.

License

The source code is released under:

MIT License

If you think the Android project feeligo_android_sdk listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package fr.baloomba.feeligo.helper;
/*from  w w w  .  j  av a  2  s.c o  m*/
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

public class JSONHelper {

    public static String getString(JSONObject object, String key) throws JSONException {
        String string = null;
        if (object != null && object.has(key) && !object.isNull(key))
            string = object.getString(key);
        return string;
    }

    public static Object get(JSONObject object, String key) throws JSONException {
        Object obj = null;
        if (object != null && object.has(key) && !object.isNull(key))
            obj = object.get(key);
        return obj;
    }

    public static Boolean getBoolean(JSONObject object, String key) throws JSONException {
        Boolean bool = false;
        if (object != null && object.has(key) && !object.isNull(key))
            bool = object.getBoolean(key);
        return bool;
    }

    public static Double getDouble(JSONObject object, String key) throws JSONException {
        Double d = .0;
        if (object != null && object.has(key) && !object.isNull(key))
            d = object.getDouble(key);
        return d;
    }

    public static JSONArray getJSONArray(JSONObject object, String key) throws JSONException {
        JSONArray jsonArray = null;
        if (object != null && object.has(key) && !object.isNull(key))
            jsonArray = object.getJSONArray(key);
        return jsonArray;
    }

    public static Integer getInt(JSONObject object, String key) throws JSONException {
        Integer integer = 0;
        if (object != null && object.has(key) && !object.isNull(key))
            integer = object.getInt(key);
        return integer;
    }

    public static JSONObject getJSONObject(JSONObject object, String key) throws JSONException {
        JSONObject jsonObject = null;
        if (object != null && object.has(key) && !object.isNull(key))
            jsonObject = object.getJSONObject(key);
        return jsonObject;
    }

    public static Long getLong(JSONObject object, String key) throws JSONException {
        Long l = 0l;
        if (object != null && object.has(key) && !object.isNull(key))
            l = object.getLong(key);
        return l;
    }

}




Java Source Code List

fr.baloomba.feeligo.FeeligoKeyboard.java
fr.baloomba.feeligo.FeeligoLog.java
fr.baloomba.feeligo.Feeligo.java
fr.baloomba.feeligo.helper.ActionBarHelper.java
fr.baloomba.feeligo.helper.DisplayHelper.java
fr.baloomba.feeligo.helper.FeeligoHelper.java
fr.baloomba.feeligo.helper.FeeligoLog.java
fr.baloomba.feeligo.helper.FeeligoSettings.java
fr.baloomba.feeligo.helper.JSONHelper.java
fr.baloomba.feeligo.helper.ViewHelper.java
fr.baloomba.feeligo.keyboard.FeeligoKeyboardGridAdapter.java
fr.baloomba.feeligo.keyboard.FeeligoKeyboardListener.java
fr.baloomba.feeligo.keyboard.FeeligoKeyboardPageAdapter.java
fr.baloomba.feeligo.keyboard.FeeligoKeyboardStickerPackPage.java
fr.baloomba.feeligo.model.StickerImage.java
fr.baloomba.feeligo.model.StickerPack.java
fr.baloomba.feeligo.model.Sticker.java
fr.baloomba.feeligo.model.UserStickerPack.java
fr.baloomba.feeligo.network.RequestBuilder.java
fr.baloomba.feeligo.network.URLBuilder.java
fr.baloomba.feeligo.store.FeeligoStickerStoreActivity.java
fr.baloomba.feeligo.store.FeeligoStickerStoreAdapter.java
fr.baloomba.feeligo.store.FeeligoStickerStoreDetailActivity.java
fr.baloomba.feeligo.store.FeeligoStoreDetailAdapter.java
fr.baloomba.feeligo.widget.FeeligoStickerImageView.java
fr.baloomba.feeligo.widget.FeeligoStickerPackTextView.java