簡體   English   中英

如何在Java Play Framework 1.2.x中從php Web服務解析序列化的json

[英]How to parse serialized json from php web service in java play framework 1.2.x

我需要使用來自php web service一些內容,該php web service通過在java play framework 1.2.x serializing jsonrendering its data 我正在使用play WS函數執行的操作。 我正在從該服務獲取數據。 但是,當我嘗試使用JSONObject獲取它時,它會拋出exepiton,這很正常,因為返回的數據看起來不像json format 任何了解任何解決方法或解決方案的機構都將不勝感激。

HttpResponse htp = WS.url("http://www.geoplugin.net/php.gp?ip=78.171.90.49").get();            
System.out.println(htp.getContentType()+"\n"+htp.getStatusText()+"\n"+htp.getString());

返回的數據:

a:18:{s:17:"geoplugin_request";s:12:"78.171.90.49";s:16:"geoplugin_status";i:200;s:16:"geoplugin_credit";s:145:"Some of the returned data includes GeoLite data created by MaxMind, available from <a href=\'http://www.maxmind.com\'>http://www.maxmind.com</a>.";s:14:"geoplugin_city";s:8:"Istanbul";s:16:"geoplugin_region";s:8:"Istanbul";s:18:"geoplugin_areaCode";s:1:"0";s:17:"geoplugin_dmaCode";s:1:"0";s:21:"geoplugin_countryCode";s:2:"TR";s:21:"geoplugin_countryName";s:6:"Turkey";s:23:"geoplugin_continentCode";s:2:"EU";s:18:"geoplugin_latitude";s:7:"41.0186";s:19:"geoplugin_longitude";s:9:"28.964701";s:20:"geoplugin_regionCode";s:2:"34";s:20:"geoplugin_regionName";s:8:"Istanbul";s:22:"geoplugin_currencyCode";s:3:"TRY";s:24:"geoplugin_currencySymbol";s:15:"&#89;&#84;&#76;";s:29:"geoplugin_currencySymbol_UTF8";s:3:"YTL";s:27:"geoplugin_currencyConverter";s:6:"2.2669";}

您正在訪問PHP端點。 您需要點擊以下網址:

http://www.geoplugin.net/json.gp?ip=78.171.90.49

暫無
暫無

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

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