Questions tagged [android-json]

JSON stands for (Java Script Object Notation). It is a simple and light-weight data interchange format that can be easily read by humans and machines.Android includes the org.json library which allow working efficiently with JSON. This provides easy parsing of JSON data and creating JSON strings

580 questions
314
votes
25 answers

How to POST raw whole JSON in the body of a Retrofit request?

This question may have been asked before but no it was not definitively answered. How exactly does one post raw whole JSON inside the body of a Retrofit request? See similar question here. Or is this answer correct that it must be form url encoded…
user3243335
  • 3,141
  • 3
  • 10
  • 4
85
votes
8 answers

Send POST request with JSON data using Volley

I would like to send a new JsonObjectRequest request: I want to receive JSON data (response from server): OK I want to send JSON formatted data with this request to the server JsonObjectRequest request = new JsonObjectRequest( …
anthony
  • 6,803
  • 7
  • 39
  • 83
33
votes
2 answers

org.json.JSONObject vs Gson library JsonObject

What are differences between this two classes? If someone uses Gson library is it preferable to use com.google.json.JsonObject over org.json.JSONObject? Could anybody list pros and cons of these 2 choices?
iamcrypticcoder
  • 1,513
  • 4
  • 17
  • 37
26
votes
4 answers

Android Studio 2.0 Preview: ':app:transformClassesWithInstantRunForDebug' FAILED

I'm getting this error in Gradle in Android Studio: :cart:transformClassesWithInstantRunForDebug FAILED Error:Execution failed for task :cart:transformClassesWithInstantRunForDebug'.> java.lang.ClassNotFoundException:…
RajeshVijayakumar
  • 9,551
  • 11
  • 53
  • 78
23
votes
4 answers

Gson - Read a value with two different keys

In my Android project I have two types of response where both response are identical except two keys. Response 1 {"fullName":"William Sherlock Scott Holmes","address":"221B Baker Street, London, England,…
Bharatesh
  • 8,375
  • 3
  • 34
  • 61
21
votes
6 answers

Convert SQLite to JSON

Is there a way to convert sqlite to json? All other questions are parsing json and saving to sqlite. I can't seem to find any reference on this, please help me. I have a sqlite db inside the app and i need it to be converted to json, upgrade db…
Lendl Leyba
  • 2,214
  • 3
  • 29
  • 47
16
votes
3 answers

How to update ui from asynctask

I've seen many examples of how to do this, but I can't figure how to implement it in my code. I am using this code. I have updated the url, so it will receive a json with dynamic data. What I'm trying to do is to automatically update the list every…
Bjorn
  • 663
  • 2
  • 11
  • 29
13
votes
3 answers

Android How can I read json file(text file) from SD Card and display data into textview

I have the following textfile into my SdCard.now i want to parse this file via Json parser,and i want to parse and read this file and display data into my textview,how i can do this? { "data": [ { "id": "1", "title": "Farhan…
Farhan Shah
  • 2,244
  • 7
  • 23
  • 52
9
votes
2 answers

Gson - Serialize Nested Object as Attributes

Is there an easy way to convert how a nested Object is converted to JSON? I'm trying to just create one JSON object to match the back-end. I'm using Retrofit for my networking, which converts an Object to JSON with Gson. I don't have access to any…
Advice-Dog
  • 4,481
  • 6
  • 29
  • 53
8
votes
3 answers

Not able to set SwipeFlingAdapterView from array adapter

i have use the https://github.com/Diolor/Swipecards and it works perfect if data is static but it is not working with AsyncTask Now i want to bind the adapter with json data. but it is not worked. public class HomeFragment extends Fragment { …
7
votes
2 answers

How to get String response from JSONObject in Volley

I have created JSONRequest by using volley, It successfully hits the service, I checked the service end, It receives the data, and send "Success" in return. The problem is that, Service returns String in output, and Volley excepts some JSON Data in…
dev90
  • 5,609
  • 11
  • 50
  • 122
7
votes
3 answers

Retrieve info from JSON bundle

While receiving a notification I am receiving some data mentioned below Bundle[{google.sent_time=1233212221545, msg={"message":"You received a chat message","type":"Match Maker","request_id":"501"}, chat={"owner":0,"request_id":"501"},…
VyTcdc
  • 946
  • 7
  • 26
6
votes
1 answer

Android - java.lang.RuntimeException: Stub exception while parsing String into JSONObject

I'm getting java.lang.RuntimeException: Stub! exception when I try to parse String to org.json.JSONObject. My Android API version is 19. Here is my String to be parsed: { "url": "http://www.google.com", "cookie": "012121", "filename":…
talha06
  • 5,286
  • 16
  • 75
  • 127
5
votes
3 answers

How to use POST method to send raw JSON using Retrofit in android

I want to post following JSON, { "name": { "firstName": "f_name", "lastName": "l_name" }, "password": "mypassword123", "email": "test.mail@gmail.com" } register method inside Interface…
ChyperX
  • 1,292
  • 2
  • 13
  • 35
4
votes
4 answers

POSTing a DateTime from Android to a WCF RESTful JSON Service

I'm trying to send a DateTime as a parameter to a method exposed over a WCF RESTful service with JSON encoding. The request looks like this: POST http://IP:PORT/LogService/json/GetLogEntriesByModule HTTP/1.1 Content-Length: 100 Content-Type:…
Hameno
  • 345
  • 3
  • 14
1
2 3
38 39