簡體   English   中英

Web服務返回json或xml?

[英]Web Service returns json or xml?

我有.asmx Web服務和方法。 但是我不確定是否返回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嗎?

可以幫助這個

 $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); 

您可以通過json獲得結果, json_decode()可以做到這一點。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM