Use JSONObject.opt() instead of JSONObject.get() so no exception is throw when value == null