Taiwan before and after parsing nested json jsp in EL and get [I]

Background java parsing

package com.test;

import java.util.List;
import java.util.Map;

import com.alibaba.fastjson.JSONObject;

public class Json1 {

    public static void main(String[] args) {

//        String reqJson = _request.getParameter("reqJson");
        String reqJson = "{\" idExpDate \ ": \" 2099-12-31 \ ", \" partyName \ ": \" Hua Xia Bank Co., Ltd. \ ", \" partyNumber \ ": \" BJ2018122110041065 \ ", \ "identityType \": \ "2 \", \ "custTree \": {\ "custTreeTopNodeCode \": \ "100207 \", \ "controlArea \": \ "\", \ "controlAreaTop \": \ "\ ", \" custTreeTopName \ ": \" Hua Xia Bank Co., Ltd. \ ", \" custTreeNodeCode \ ": \" 100207 \ ", \" controlDepTop \ ": \" 13007005 \ ", \" controlTypeTop \ ": \" 13013001 \ ", \" controlType \ ": \" 13013001 \ ", \" custTreeName \ ": \" Hua Xia Bank Co., Ltd. \ ", \" controlDep \ ": \" 13007005 \ "}, \" orgUscc \ " : \ "9111000010112001XW \", \ "partyCert \": [{\ "certNum \":\"qazwsxed3\",\"certType\":\"\",\"partyCertId\":\"259941363\"},{\"certNum\":\"9111000010112001XW\",\"certType\":\"49\",\"partyCertId\":\"820108430\"}],\"industryCd\":\"DD0302\",\"isAvailable\":\"1\",\"idEffDate\":\"1992-10-14\",\"industryTypeId\":\"177\",\"orgStatusCd\":\"4\",\"partyId\":\"259941363\",\"registerAddr\":\"北京市东城区建国门内大街22号\"}"\"industryCd\":\"DD0302\",\"isAvailable\":\"1\",\"idEffDate\":\"1992-10-14\",\"industryTypeId\":\"177\",\"orgStatusCd\":\"4\",\"partyId\":\"259941363\",\"registerAddr\":\"北京市东城区建国门内大街22号\"}"\"industryCd\":\"DD0302\",\"isAvailable\":\"1\",\"idEffDate\":\"1992-10-14\",\"industryTypeId\":\"177\",\"orgStatusCd\":\"4\",\"partyId\":\"259941363\",\"registerAddr\":\"北京市东城区建国门内大街22号\"}";
        JSONObject jsonData = JSONObject.parseObject(reqJson);
        String partyName = String.valueOf(jsonData.get("partyName"));
        List<Map<String, String>> partyCertList = (List<Map<String, String>>) jsonData.get("partyCert");
        for (int i = 0; i < partyCertList.size(); i++) {
            Map partyCertMap = partyCertList.get(i);
            System.out.println(partyCertMap);
        }
    }
}

/*

{
    "idExpDate": "2099-12-31",
    "partyName": "Huaxia Bank Co., Ltd. "
    "partyNumber": "BJ2018122110041065", 
    "IdentityType": "2", 
    "custTree": { 
        "custTreeTopNodeCode": "100 207", 
        "the ControlArea": "", 
        "controlAreaTop": "", 
        "custTreeTopName": "China Bank Co., Ltd. ", 
        " custTreeNodeCode ":" 100 207 ", 
        " controlDepTop ":" 13,007,005 ", 
        " controlTypeTop ":" 13,013,001 ", 
        " controlType ":" 13,013,001 ", 
        " custTreeName ":" Hua Xia Bank Co., Ltd. ", 
        " controlDep ":" 13,007,005 " 
    },
    "orgUscc": "9111000010112001XW",
    "partyCert": [
        {
            "certNum": "qazwsxed3",
            "certType": "",
            "partyCertId": "259941363"
        },
        {
            "certNum": "9111000010112001XW",
            "certType": "49",
            "partyCertId": "820108430"
        }
    ],
    "industryCd": "DD0302",
    "isAvailable": "1",
    "idEffDate": "1992-10-14",
    "industryTypeId": "177",
    "orgStatusCd": "4",
    "partyId": "259941363",
    "registerAddr": "北京市东城区建国门内大街22号"
}


*/

 

Reception jsp get:

<script type="text/javascript">
    var regionType='${sessionScope.SSO_AUTH_USER.regionType}';
    var handleOrgId='${sessionScope.SSO_AUTH_USER.orgId}';
    var systemUserId = '${sessionScope.SSO_AUTH_USER.acctId}';
    var staffId = '${sessionScope.SSO_AUTH_USER.staff_id}';
    var regionCode = '${sessionScope.SSO_AUTH_USER.regionCode}';
    // request page jump json, connotation party information 
    var reqJson = $ {map.reqJson};
 </ Script >

Note: If map.reqJson value json is a string, then the EL expression not in double / single quotes here.

 

 

Reception js Analysis:

$ ( Function () {
     // arbitrary acquiring a set of valid partyCert, and remove excess property 
    var pratyCertArr = reqJson.partyCert;
     var certNum = "" ;
     var certtype = "" ; 
    $ .each (pratyCertArr, function (I, Item ) {
         IF (item.certNum && item.certType) { 
            certNum = item.certNum; 
            certtype = item.certType;
             return  to false ; 
        } 
    }); 
    Delete reqJson [ "partyCert" ]; 
    reqJson.certNum = certNum;
    reqJson.certType = certType;
    delete reqJson["custTree"];
//    alert(JSON.stringify(reqJson));
     init();
});

 

Guess you like

Origin www.cnblogs.com/libin6505/p/12144307.html