我有.asmx网络服务和方法。但我不确定是否会回报json。
它会以Json的形式返回吗?
<string xmlns="http://tempuri.org/">
{ "Table": [ { "Key1": "x", "Key2": "x", "Key3": "Ads" } ], "Key4": [ { "Key41": "30", "Key42": "12", "Key43": "1" } ], "Key5": [ { "Key51": "10.4.2017 00:00:00" } ] }
</string>
因此,方法结果页面将该文本写在顶部:
This XML file does not appear to have any style information associated with it. The document tree is shown below.
我可以将此数据作为json获取吗?
答案 0 :(得分:0)
可以帮助这个
$cont_data = array( "Table"=>array( "Key1"=> "x",
"Key2"=> "x",
"Key3"=> "Ads"
),
"Key4"=>array(
"Key41"=> "30",
"Key42"=> "12",
"Key43"=> "1"
),
"Key5"=>array(
"Key51"=>"10.4.2017 00:00:00"
)
);
return json_encode($cont_data);
&#13;
你可以把结果作为json, json_decode()来做到这一点。