pljson获取Json类型数据的内容

pljson获取Json类型数据

image-20210428100930975

DECLARE   
     cardID varchar2(1000);
     Json_out pljson;  
     baseInfo pljson;
begin
  cardID := '123'  ;
  pak_ybhttp.GetPatientInfo(cardID =>cardID,Json_out => Json_out);
  dbms_output.put_line(Json_out.to_char);
  --获取二级json对象
  baseInfo := pljson_ext.get_json(Json_out,'baseInfo');
  dbms_output.put_line(baseInfo.to_char);
  --获取json对象中的字符串 
  dbms_output.put_line(pljson_ext.get_string(Json_out,'InfoMsg'));
  --获取嵌套的json字符串
  dbms_output.put_line(pljson_ext.get_string(Json_out,'baseInfo.MZ'));
  --获取json对象中的bool值
  dbms_output.put_line(case when pljson_ext.get_bool(Json_out, 'Success') then 'true' else 'false' end);
end;  
  • 执行结果
{
  "baseInfo" : {
    "GRBH" : "1",
    "DWBH" : "2",
    "SFZH" : "3",
    "XM" : "4",
    "XB" : "\u7537",
    "MZ" : "\u6C49\u65CF",
    "CSRQ" : "7",
    "SHBZK" : "8",
    "YLDYLB" : "9",
    "RYCBZT" : "10",
    "YDRYBZ" : "11",
    "TCQH" : "12",
    "ND" : "13",
    "ZYZT" : "14",
    "ZHYE" : "15",
    "BNYLFLJ" : "16",
    "BNZHZCLJ" : "17",
    "BNTCZCLJ" : "18",
    "BNJZJCLJ" : "19",
    "BNGWYBZJJLJ" : "20",
    "CZJBMZTCZFLJ" : "21",
    "TCFYLJ" : "22",
    "JZJFYLJ" : "23",
    "QFBZLJ" : "24",
    "BNZYCS" : "25",
    "DWMC" : "26",
    "NL" : "27",
    "CBDWLX" : "28",
    "JBJGBM" : "29",
    "ELMMXEZC" : "30",
    "ELMMXESY" : "31",
    "YLDYXZ" : "32",
    "GSDYXZ" : "33",
    "SYDYXZ" : "34",
    "TS" : "35",
    "BXGS" : "36",
    "MZJZBZ" : "37",
    "JMYFDX" : "38"
  },
  "Success" : true,
  "InfoMsg" : "\u83B7\u53D6 123 \u4E2A\u4EBA\u57FA\u672C\u4FE1\u606F\u53CA\u8D26\u6237\u4FE1\u606F\u67E5\u8BE2\u6210\u529F",
  "ErrorMsg" : null
}
{
  "GRBH" : "1",
  "DWBH" : "2",
  "SFZH" : "3",
  "XM" : "4",
  "XB" : "\u7537",
  "MZ" : "\u6C49\u65CF",
  "CSRQ" : "7",
  "SHBZK" : "8",
  "YLDYLB" : "9",
  "RYCBZT" : "10",
  "YDRYBZ" : "11",
  "TCQH" : "12",
  "ND" : "13",
  "ZYZT" : "14",
  "ZHYE" : "15",
  "BNYLFLJ" : "16",
  "BNZHZCLJ" : "17",
  "BNTCZCLJ" : "18",
  "BNJZJCLJ" : "19",
  "BNGWYBZJJLJ" : "20",
  "CZJBMZTCZFLJ" : "21",
  "TCFYLJ" : "22",
  "JZJFYLJ" : "23",
  "QFBZLJ" : "24",
  "BNZYCS" : "25",
  "DWMC" : "26",
  "NL" : "27",
  "CBDWLX" : "28",
  "JBJGBM" : "29",
  "ELMMXEZC" : "30",
  "ELMMXESY" : "31",
  "YLDYXZ" : "32",
  "GSDYXZ" : "33",
  "SYDYXZ" : "34",
  "TS" : "35",
  "BXGS" : "36",
  "MZJZBZ" : "37",
  "JMYFDX" : "38"
}
获取 123 个人基本信息及账户信息查询成功
汉族
true
posted @ 2021-04-28 10:17  STR少寒  阅读(338)  评论(0编辑  收藏  举报