显示JSON值

时间:2016-02-21 08:52:32

标签: php json

我想问一下如何在PHP中解析它并将值作为字符串返回。

这是给定的JSON

{
"SOAP:Header": [],
"SOAP:Body": {
    "rfc:ZFI_MVIS_ASSET_MASTER.Response": {
        "ZMVISASSET": {
            "item": [
                {
                    "BUSINESS_UNIT": "123",
                    "KFZKZ": "xxx123",
                    "NAME": "lastname, firstname  middle"
                },
            ]
         }
    }
}

}

所以基本上我想从JSON获取BUSINESS_UNIT和NAME并在页面上回显它。

尝试了这个,但没有得到值和响应错误。

echo $res->SOAP:Body->rfc:ZFI_MVIS_ASSET_MASTER.Response->ZMVISASSET->item->BUSINESS_UNIT;

1 个答案:

答案 0 :(得分:0)

(cv) Francess-MacBook-Pro-2:face_morpher Megan$ frameworkpython facemorpher/averager.py --images=IMFDB_final/Ali/HelloBrother/images --out=average.png
Traceback (most recent call last):
File "facemorpher/averager.py", line 94, in <module>
    args['--out'], args['--plot'])
File "facemorpher/averager.py", line 61, in averager
    img, points = load_image_points(path, size)
File "facemorpher/averager.py", line 46, in load_image_points
    img = scipy.ndimage.imread(path)[..., :3]
 File "/Users/Megan/.virtualenvs/cv/lib/python2.7/site-packages/scipy/ndimage/io.py", line 25, in imread
raise ImportError("Could not import the Python Imaging Library (PIL)"
ImportError: Could not import the Python Imaging Library (PIL) required to load image files.  Please refer to http://pypi.python.org/pypi/PIL/ for installation instructions.

输出

<?php
$json = '{"a":1,"b":2,"c":3,"d":4,"e":5}';
var_dump(json_decode($json));
var_dump(json_decode($json, true));
?>