# HTTP output - Mapping reference to object make it string

**URL:** https://discuss.elastic.co/t/http-output-mapping-reference-to-object-make-it-string/358721
**Category:** Logstash
**Created:** [May 3, 2024, 2:29pm UTC](https://discuss.elastic.co/t/http-output-mapping-reference-to-object-make-it-string/358721 "2024-05-03T14:29:10Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![AfiLouis](https://avatars.discourse-cdn.com/v4/letter/a/13edae/32.png) [@AfiLouis](https://discuss.elastic.co/u/AfiLouis)
#### Post date: [May 3, 2024, 2:29pm UTC](https://discuss.elastic.co/t/http-output-mapping-reference-to-object-make-it-string/358721/1 "2024-05-03T14:29:10Z")

</div>

Hi,

I have made the following object using grok, ruby code and field mutation :

```auto
{
    // ...
    "E2E"=> {  
        "scenarioId" => "drg",
        "XFT": {
            "name": "xft_name",
            "RQ": "<RQ>",
            "natives": [ // don't know how many natives I can have
                {
                    "name": "native_name1",
                    "target": "native_target1",
                    "host": "native_host1",
                    "RQ": "<RQ1>",
                    "RS": "<RS1>"
                },
                {
                    "name": "native_name2",
                    "target": "native_target2",
                    "host": "native_host2",
                    "RQ": "<RQ2>",
                    "RS": "<RS2>"
                }
            ]
        }
    }
}

```

I need to send the content of E2E property on the request body of an HTTP API URL, I try the following code in the output but an empty value is sent :

```ruby
http {
    format => "message"
    http_method => "put"
    url => "myURL"
    message => "%{E2E}" # send an empty value
    retry_failed => false
}

```

I try with the json format and mapping but it send the object as a string :

```ruby
http {
    format => "json"
    http_method => "put"
    url => "MyURL"
    mapping => {
        "" => "%{E2E}" # make a string of the object
        # "" => "%{[E2E]}" # make a string of the object (same as above)
        # "" => [E2E] # make a string = "E2E"
    }
    retry_failed => false
}

```

Can I get some help please ?

thank's by advance

---

<div class="post-metadata">

### Author: ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)
#### Post date: [May 3, 2024, 5:38pm UTC](https://discuss.elastic.co/t/http-output-mapping-reference-to-object-make-it-string/358721/2 "2024-05-03T17:38:23Z")

</div>

> [@AfiLouis](#):
>
> it send the object as a string

What do you mean by that? HTTP transports text. Everything has to be converted to a string.

---

<div class="post-metadata">

### Author: ![AfiLouis](https://avatars.discourse-cdn.com/v4/letter/a/13edae/32.png) [@AfiLouis](https://discuss.elastic.co/u/AfiLouis)
#### Post date: [May 6, 2024, 7:41am UTC](https://discuss.elastic.co/t/http-output-mapping-reference-to-object-make-it-string/358721/3 "2024-05-06T07:41:55Z")

</div>

When i use Postman, I can fill the body with a json and I don't think that json is converted to a string, did I miss something ? 🤔 (it works well with postman)

So I need to send a json in the request body from logstah.

---

<div class="post-metadata">

### Author: ![AfiLouis](https://avatars.discourse-cdn.com/v4/letter/a/13edae/32.png) [@AfiLouis](https://discuss.elastic.co/u/AfiLouis)
#### Post date: [May 6, 2024, 8:31am UTC](https://discuss.elastic.co/t/http-output-mapping-reference-to-object-make-it-string/358721/4 "2024-05-06T08:31:33Z")

</div>

Found the solution, just need to set `content_type` to `application/json`

```auto
http {
    content_type => "application/json"
    format => "message"
    http_method => "put"
    url => "MyURL"
    message => "%{E2E}"
    retry_failed => false
}

```
