how do i get the website in json format? - android

i need to get a website (any website ) in json format to use it with android and json parser to get data and if possible that the website include images to be able to download data and images using json parser.
i have been searching about 2 days without any success, its my first time that i use json so i do know where to search and how to search.
what i need is a website to make a test on it that will be available in json format
anyone can help me ???
i will appreciate that.

Use http://www.jsontest.com/ to get JSON from that website.
Read there and for example if you call http://ip.jsontest.com/ you will get a JSON response as {"ip": "203.92.62.242"} then you can parse them in your android application.

For future readers :
Facebook programmers provide the json format for each request.
All you have to do is :
If the facebook page url is : http://www.facebook.com/youtube
To get json format of page, request this : http://graph.facebook.com/youtube
I suggest to read that :
Usually standard web service today provide data in at least two format: json and xml for each endpoint (url), you just add .xml or .json extension to the requested url.
But most of the time you don't have to do that, common web services today always provide json data because it's defined in RESTFul rules. If they dont, you can't get the json. The case is same for you, just ask the developer for API docs.

Related

Sample WebService url to get and post values like email and password from android

I want a sample WebService URL, which can be used to practice android networking with volley.
I know there are many sample URLs which send Json data but I want a WebService URL which accepts and store data (may be in MySql Database) like(email,password) sent by android app.
I want to practice these things but I have not found required setup for this,
if such type of free WebService is not available then please suggest me how can I practice android networking, specially Posting data to server (usually used in user signup and sign-in)
Thanks :)
Here is what you want to practice Networking
Webservice Type : REST
Returns a list of cities and placenames in the bounding box, ordered by relevancy (capital/population). Placenames close together are filterered out and only the larger name is included in the resulting list.
JSON URL :
Click here
Same output in XML format :-
XML URL : Click here

Android :How to parse data from server into JSON? Do I need to write a file and where do I store this file?

I have read questions available on forum but I am still confused. Is it possible to read app's data from server using JSON? App data is available from server in HTML form. How to parse this html webpage into JSON? Where to store JSON parsing file(I mean in which folder). I'm not using wordpress/cms for blog/data. Thanks for your help!
You usually do not read data from a server in HTML format. HTML is used to display something in a browser or in a WebView. For data, you use either JSON or XML, where JSON is the standard these days. So you server has to provide a service that returns JSON. There might be some cases where you want to read HTML, but you would not parse it into JSON. There is no point in doing so. You had to read it as XML and find the data you are interested in. The problem with that approach is that HTML is often not well formed - not every opening tag has a corresponding closing tag. While browsers are fine with that, XML parser are usually not and your app will crash.

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!
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 -
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
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"
}

Need help for communication between server database and android app

I am developing an Android based app that does both the things:
Add data to the server.
Fetch data from the server.
Data consists of a multimedia file which can be either:
Picture + Some info about Picture
Video + Some info about Video
Simple Text + Some info about the text
In the above, info consists of things like Latitude, longitude, user name etc.
I want to know as to how to achieve the desired ?
I have been suggested to use JSON based object and pass it to the android app.
I know how to parse the JSON object but have no idea about things like:
How does the android app running on mobile device requests for JSON object ? (meaning which URL to ask)
How to pass the multimedia object (Picture/Video) from server to App in form of JSON object?
How to send data from android app running of android based phone to the server ?
Thanks in advance !
Let me try to answer your questions;
You need to have a service running on the server. Android parses the json and sends it to this service. So you will need to use the URL of your service.
You can pass multimedia objects to the service by converting it to a Byte or Base64String.'
With regards to how to parse the json and send it to the server, I'd recommend you look at google-gson. This is one of the most commonly used libraries when working with JSON
Look into this link for a more indepth tutorial on Json parsing
Note: While JSON is the recommended way to pass objects to and from the server, wsdl is another option you can use.
You can do that by converting to Base64String. Check this link

Get Json Information? (Noob)

I'm new to both using json and developing for android, however I'm looking to learn how to retrieve information using a json api key.
Let's say this website has all the information I need. How can I access and store that information?
https://website.com/api/user/key/a015b92aec875bd24e8fdc73477bfdcr
For example it would have something like this,
{"balance":"123","due":"3426"}
To access it, you need to open HTTPS connection to the server that has that API key, which is that https address you just provided. The server will return the JSON objects for you, to parse the string data, you can use GSON. GSON will translate all the JSON objects into Java objects, and it will help you populate your pre-built Java data structures with those data
You can get the web content using the Android HTTPClient (or follow something like the guide on this page).
For storage, you need to parse the JSON - see this SO question.
For storage, either store the raw JSON in a file or create an SQLite database and store it according to your specifications.

Categories

Resources