HTTP output - Mapping reference to object make it string

Hi,

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

{
    // ...
    "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 :

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 :

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

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

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 ? :thinking: (it works well with postman)

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

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

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