# How to post data in ruby ? Plz Help!

**URL:** <https://www.ruby-forum.com/t/how-to-post-data-in-ruby-plz-help/131152>\
**Category:** Ruby\
**Created:** [March 6, 2008, 2:27pm UTC](https://www.ruby-forum.com/t/how-to-post-data-in-ruby-plz-help/131152 "2008-03-06T14:27:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![pradeepta](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/ee59a6/32.png) [@pradeepta](https://www.ruby-forum.com/u/pradeepta)\
**Post date:** [March 6, 2008, 2:27pm UTC](https://www.ruby-forum.com/t/how-to-post-data-in-ruby-plz-help/131152/1 "2008-03-06T14:27:39Z")

</div>

Hi ,

```
  I am trying to send a json object through ruby whose equivalent

```

code in java script is req.send(jsonobject) , also i want to add headers  
to the request . I am using the code request.add\_field(“Cookie”,“12345”)

How can i send jsonobject using the same request object ??

---

<div class="post-metadata">

**Author:** ![pradeepta](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/ee59a6/32.png) [@pradeepta](https://www.ruby-forum.com/u/pradeepta)\
**Post date:** [March 7, 2008, 4:05am UTC](https://www.ruby-forum.com/t/how-to-post-data-in-ruby-plz-help/131152/2 "2008-03-07T04:05:53Z")

</div>

Pradeepta S. wrote:

> Hi ,
> 
> ```
> I am trying to send a json object through ruby whose equivalent
> 
> ```
> 
> code in java script is req.send(jsonobject) , also i want to add headers  
> to the request . I am using the code request.add\_field(“Cookie”,“12345”)
> 
> How can i send jsonobject using the same request object ??

check out the gem mechanize [http://mechanize.rubyforge.org/mechanize/](http://mechanize.rubyforge.org/mechanize/)

hth

ilan
