Lucas Castellani
Lucas Castellani

Reputation: 39

Getting json data about posts

I learned in a blog reader tutorial to grap the json file and put on the code. How can I take it from a wordpress blog?

for example: http://blog.teamtreehouse.com/api/get_recent_summary/?count=20

Thanks!

Upvotes: 0

Views: 148

Answers (1)

VJ Vélan Solutions
VJ Vélan Solutions

Reputation: 6554

Well, i am guessing your final goal is to parse the json data after you get it from the website. Right? If that's the case, you can go about it in two ways -

  1. You can directly access the URL in android application using HTTP post method giving count parameter and value 20 and get the response and decode it using JSON parser

  2. If you want to do it offline i.e not connect your android device to internet, then you can simply save the data into a file and place the file in your assets folder of your application and then open the file and read it and parse it. On Chrome web-browser, you can use REST client that makes it a bit convenient to store the json data into a file.

Now, depending on which way you want to go, you will have to investigate that route to get more implementation details on the same.

HTH.

posts: [20]
0:  {
      id: 22313
      url: "http://blog.teamtreehouse.com/best-free-jquery-form-plugins-to-improve-user-experience"
      title: "Best Free jQuery Form Plugins to Improve User Experience"
      date: "2013-09-26 10:07:23"
      author: "Jake Rocheleau"
      thumbnail: "http://blog.teamtreehouse.com/wp-content/uploads/2013/09/autotab-jquery-plugin-preview-150x150.jpg"
}

Upvotes: 1

Related Questions