var json =
{
"RepContent":
{
"reportID":"BEC3B226-431B-4167-9A8E-D03244E3E9E2",
"PatientID":"75367C0B-4C15-41D7-94E2-55B5283808EF",
"DocNo":"201305021401",
"PatientName":"李三",
"Sex":"男",
"DocDate":"2013-05-02",
"FunCodes":"1,2,21,22,27,6",
"XYInfo":
{
"TjDataS":
[
{"XM":"收缩压","Unit":"","Range":"90--140","Tip":"","maxValue":"130","minValue":"88","avgValue":"115"},
{"XM":"收缩压","Unit":"","Range":"60--90","Tip":"","maxValue":"79","minValue":"66","avgValue":"72"},
{"XM":"心率","Unit":"","Range":"","Tip":"","maxValue":"80","minValue":"52","avgValue":"66"}
],
"xyXJ":
{
"doctorName":"程大明",
"doctorDate":"2013-05-02",
"Content":""
},
"RangeDate":"(2013\/04\/02--2013\/05\/02)",
"imgBase64":"XXXX"
},
"t_conclusion":"",
"t_advice":"",
"t_doctor":"程大明",
"t_adDate":"2013-05-02 14:01"
},
"XyTime":"2013-05-08 17:27:19",
"ErrText":""
}
上面json数据感觉有点复杂,我想取imgbase64节点数据,结果取不出来:json.RepContent.XYInfo.TjDataS.imgBase64,
这样取json.RepContent.XYInfo 结果为[object object];
请教高手帮看下给如何获得imgbase64节点数据。
多谢!

解决方案 »

  1.   

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>无标题文档</title>
    <script type="text/javascript">
    var json ={
    "RepContent":{
    "reportID":"BEC3B226-431B-4167-9A8E-D03244E3E9E2",
    "PatientID":"75367C0B-4C15-41D7-94E2-55B5283808EF",
    "DocNo":"201305021401",
    "PatientName":"李三",
    "Sex":"男",
    "DocDate":"2013-05-02",
    "FunCodes":"1,2,21,22,27,6",
    "XYInfo":{
    "TjDataS":[
    {"XM":"收缩压","Unit":"","Range":"90--140","Tip":"","maxValue":"130","minValue":"88","avgValue":"115"},
    {"XM":"收缩压","Unit":"","Range":"60--90","Tip":"","maxValue":"79","minValue":"66","avgValue":"72"},
    {"XM":"心率","Unit":"","Range":"","Tip":"","maxValue":"80","minValue":"52","avgValue":"66"}
    ],
    "xyXJ":{
    "doctorName":"程大明",
    "doctorDate":"2013-05-02",
    "Content":""
    },
    "RangeDate":"(2013\/04\/02--2013\/05\/02)",
    "imgBase64":"XXXX"
    },
    "t_conclusion":"",
    "t_advice":"",
    "t_doctor":"程大明",
    "t_adDate":"2013-05-02 14:01"
    },
    "XyTime":"2013-05-08 17:27:19",
    "ErrText":""
    };
    alert(json.RepContent.XYInfo.imgBase64);
    </script>
    </head><body>
    </body>
    </html>
    写的时候注意下缩进就容易看出一点了