Export to GitHub

chrome-rest-client - issue #228

POST request containing JSON arrays


Posted on Jan 13, 2014 by Quick Wombat

Is it possible to send a POST requst to a RESTful service with your tool encoded as 'application/json', containing JSON arrays? How would I generate a request with JSON arrays?

{ "id":"2" 
 ,"name":"Bob"
 ,"addresses":[{"street":"Long Street 1","town":"Short Village"}
              ,{"street":"Short Street 1000","town":"Long Village"}]}

When I try to use the Raw Panel, I get URL encoded parameters, and no JSON Raw content, as I would have expected. id=2&name=Bob&addresses=%3F

Is it possible to either generate a request with JSON array, or where do I enter the JSON Raw data (with which content-type settings in your tool)?

Thanks for your effort

Attachments

Comment #1

Posted on Jan 13, 2014 by Quick Wombat

I think I have found the solution. My mistake was trying to fit the JSON Arrays into the Form fields (being a contradiction by itself).

The solution was to solely use the Raw panel & copy/paste the JSON code (includining the JSON Arrays) there.

Attachments

Comment #2

Posted on Jan 13, 2014 by Quick Wombat

feel free to close / remove the issue.

Comment #3

Posted on Jun 5, 2014 by Happy Rhino

This post was helpful to me... thank you.

Comment #4

Posted on Jun 15, 2014 by Swift Horse

thanks lot

Comment #5

Posted on Jun 19, 2014 by Quick Bear

Hi i am working on Web Api's and i am not finding way how to use chrome rest client for post method with parameters if i have parameters in key-value pair where key is blank and value has all the values like this: { '': '{"UserEmail":"pankaj.softprodigy1@gmail.com","UserPassword":"123456" }' }, and the method is written as : public string PostLogin([FromBody] string value) { } where value has to accept this.

Comment #6

Posted on Jun 19, 2014 by Quick Wombat

The best approach usually is to see what the GET response of your API looks like and to take this as the base for your POST/PUT call.

Also take a look at the screenshot "POST-successful.gif". Your JSON code most likely is missing squared brackets... and do you hash encode the user password?

Status: New

Labels:
Type-Other Priority-Medium