I am Begineer in Android.In my Project, I am getting the Following json from the HTTP Response.
[{"Date":"2012-1-4T00:00:00","keywords":null,"NeededString":"this is the sample string I am needed for my project","others":"not needed"}]
I want to get the "NeededString" from the above json.How to get it.
Here is the solution I used for me Is works for fetching JSON from string
If you can use JSONObject library, you could just
You can use
getString
or
optString
Include
org.json.jsonobject
in your project.You can then do this:
Assuming,
responseString
holds the response you receive.If you need to know how to convert the received response to a String, here's how to do it:
i think its helpfull to you
You just need to get the
JSONArray
and iterate theJSONObject
inside the Array using a loop though in your case its only one JSONObject but you may have more.