简体   繁体   English

使用JSON API Wordpress获取数据

[英]Get data using json api wordpress

I think using JSON Parse more functional better than RSS Reader if you wanna create native mobile android application. 我想,如果您想创建本机移动android应用程序,则使用JSON Parse比RSS Reader更好的功能。 Installing Wordpress and Plugin JSON API in backend then using Asynctask vs Volley Library to frontend Android. 在后端安装Wordpress和插件JSON API,然后使用Asynctask vs Volley Library来前端Android。 Show data to ListView - OnItemClickListener to get Item more details. 将数据显示到ListView-OnItemClickListener以获取Item的更多详细信息。 but unfortunately JSON File have something different in Content Array because content including img class. 但不幸的是,JSON文件在内容数组中有所不同,因为内容包括img类。

"content":"<p><img class=\"alignnone size-medium wp-image-7\" src=\"http:\/\/localhost\/novemberproject\/wordpress\/wp-content\/uploads\/2014\/11\/1522040_20130503100310-300x233.jpg\" alt=\"1522040_20130503100310\" width=\"300\" height=\"233\" \/><\/p>\n<p>A sports car (sportscar) is a small, usually two seater, two door automobile designed for spirited performance and nimble handling.<\/p>\n"

If result put to TextView, will get an error : 如果将结果放入TextView,将出现错误:

" Invalid escape sequence (valid ones are \b \t \n \f \r \" \' \\ ) ". 

Anyone have time to explain, how to implementation on this case study? 谁有时间解释,如何在这个案例研究中执行? Thank You. 谢谢。

You can add your data to empty array. 您可以将数据添加到空数组。 And convert to json, this array. 并转换为json,这个数组。 So, you do not have write JSON yourself. 因此,您不必自己编写JSON。 *with: json_encode *使用: json_encode

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM