GET custom header value as object (JSON.stringify())

Hi,

I am trying to add an object value to my custom header. It needs JSON.stringify() so the server will be able to JSON.parse() it back to an object.

How can I make an object as a value in the UI?

Thanks!

  1. Replace the value with a variable, say {{customHeader}}

  2. In the pre-request script, write something like following code (not tested):

    const customHeader = {
    type: “myType”
    };

    pm.globals.set(“customHeader”, JSON.stringify(customHeader));

Thanks, @vdespa. So I guess it can’t be done by simply typing something into the value field?

Of course. It is just a string.

I mean in the UI. I tried a bunch of permutations, none worked.