-1

I'm trying to make an Http GET and send JSON as input:

https://host/X/Y?input={"foo":"bar","baz":"yak"}

according to these posts:

HttpGet with request body android

Apache's HttpGet (used by Android) does not support this kind of thing.

I've tried some of the alternatives specified in that post and they haven't worked.

First, can someone confirm Apache's HttpGet won't let you send JSON.

Next, can someone suggest any ways around this - alternate libraries, other classes, anything ….

Community
  • 1
  • 1
user1126515
  • 1,133
  • 3
  • 17
  • 34

2 Answers2

0

When submitting JSON, you might prefer using POST instead if GET. In case you do want to use GET, don't forget to encode your URL with URLEncoder.encode(json, "UTF-8"). This might be the cause of your problem.

user2733845
  • 43
  • 1
  • 1
  • 7
0

put some json into a file and this example will post it

dont know why a GET would be used with much json info?

Figure out the 'entities' implementation along with POST and choose a better httpclient than you are using.

Robert Rowntree
  • 6,230
  • 2
  • 24
  • 43