Read content from file in raw json request body

@emrehidden Welcome to the community :partying_face:

Yes you can do that using data driven method. To know more about it please read.

Say this is my example below:

here in the body I just need to replace the email field alone. So I have added curly braces and just named it as email. The name should be given to the attribute in the file as well. You don’t need to define anything more here. Postman is smart enough to read the variables names and match them with the input file provided.

Here I would just need to replace my email alone, and password remains the same.

The data file can either look like:

Only the fields needed,
image

or the entire file:

In both the cases “email” is mandatory in the file because that’s the field you are referring to in your body.

So in your case,

{
    "key1": "value1",  // a normal value
    "key2": "{{key2}}" // a very long object. I want to read this from file
}

you can access the key2 from the JSON file. If the field name is different in the JSON file, pass the field name from which you need to copy the value and pass it under key2.

Hope this is useful :blush:
Let me know if you have any other questions.