繁体   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