2121import com .alibaba .fastjson .parser .Feature ;
2222import com .alibaba .fastjson .serializer .SerializerFeature ;
2323
24- import zuo .biao .apijson .server .Log ;
25-
26- /**阿里json封装类 防止解析时异常
24+ /**阿里FastJSON封装类 防止解析时异常
2725 * @author Lemon
2826 */
2927public class JSON {
@@ -34,7 +32,7 @@ public class JSON {
3432 * @return
3533 */
3634 public static boolean isJsonCorrect (String s ) {
37- Log .i (TAG , "isJsonCorrect <<<< " + s + " >>>>>>>" );
35+ // Log.i(TAG, "isJsonCorrect <<<< " + s + " >>>>>>>");
3836 if (s == null
3937 // || s.equals("[]")
4038 // || s.equals("{}")
@@ -171,7 +169,7 @@ public static String toJSONString(Object obj) {
171169 try {
172170 return com .alibaba .fastjson .JSON .toJSONString (obj );
173171 } catch (Exception e ) {
174- Log .i (TAG , "toJSONString catch \n " + e .getMessage ());
172+ Log .e (TAG , "toJSONString catch \n " + e .getMessage ());
175173 }
176174 return null ;
177175 }
@@ -188,7 +186,7 @@ public static String toJSONString(Object obj, SerializerFeature... features) {
188186 try {
189187 return com .alibaba .fastjson .JSON .toJSONString (obj , features );
190188 } catch (Exception e ) {
191- Log .i (TAG , "toJSONString catch \n " + e .getMessage ());
189+ Log .e (TAG , "parseArray catch \n " + e .getMessage ());
192190 }
193191 return null ;
194192 }
@@ -221,9 +219,7 @@ public static boolean isJSONObject(Object obj) {
221219 JSONObject json = parseObject ((String ) obj );
222220 return json != null && json .isEmpty () == false ;
223221 } catch (Exception e ) {
224- //太长 System.out.println(TAG + "select while (rs.next()){ >> i = "
225- // + i + " try { json = JSON.parse((String) value);"
226- // + ">> } catch (Exception e) {\n" + e.getMessage());
222+ Log .e (TAG , "isJSONObject catch \n " + e .getMessage ());
227223 }
228224 }
229225
@@ -242,14 +238,11 @@ public static boolean isJSONArray(Object obj) {
242238 JSONArray json = parseArray ((String ) obj );
243239 return json != null && json .isEmpty () == false ;
244240 } catch (Exception e ) {
245- //太长 System.out.println(TAG + "select while (rs.next()){ >> i = "
246- // + i + " try { json = JSON.parse((String) value);"
247- // + ">> } catch (Exception e) {\n" + e.getMessage());
241+ Log .e (TAG , "isJSONArray catch \n " + e .getMessage ());
248242 }
249243 }
250244
251245 return false ;
252246 }
253247
254-
255248}
0 commit comments