zoukankan      html  css  js  c++  java
  • 【JSON】随笔记

    1、Json对象列表

    import com.alibaba.fastjson.JSON;
    import com.alibaba.fastjson.JSONObject;
        /**
         * 将传入的JSON参数转换为list
         * "[{"activeId":"111","circleId":"222","redEnvelopeName":"","securityCode":"","activeStartTime":""}]";
         * @param configureListJson 配置项json
         */
        private List<RedPacketConfiguration> getConfigureList(String configureListJson) throws JSONException{
            List<RedPacketConfiguration> list;
    
            try {
                list = JSONObject.parseArray(configureListJson, RedPacketConfiguration.class);
            } catch (Exception e) {
                logger.error("JSON 转换异常,JSON="+configureListJson);
                AteyeLogHelper.writeRedPacketLog("JSON 转换异常,JSON="+configureListJson);
                throw new JSONException("JSON 转换异常,JSON="+configureListJson);
            }
            return list;
    
        }
    List  list = JSONObject.parseArray("["143754"]", String.class);
    System.out.println(list);
  • 相关阅读:
    实习项目1.
    try catch finally的用法
    asp.net 验证控件
    数据库操作语言
    webform Response的一些成员
    jQuery
    C#@的用法
    SQL分页查询
    抽象类与接口的区别
    抽象类与接口
  • 原文地址:https://www.cnblogs.com/the-fool/p/11451442.html
Copyright © 2011-2022 走看看