Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Postman: POST request of nested JSON via form-data not working (while via raw-data ok)

Tags:

json

postman

I want to POST the following JSON-object via Postman:

{
    "title": "test_title",
    "date": "2021-12-31",
    "attachments": [
        {
            "name": "test_attachment"
        }
    ]
}

This works perfectly fine, when using Postman's raw input form for the request-body: I get a "201 Created"-response back.

However, when using the form-data to POST the data, I get the error "Invalid data. Expected a dictionary, but got str." (see also screenshot below) What am I doing wrong here? I tried all kind of other versions to enter the attachment-key:value pair but nothing worked so far enter image description here

like image 483
Daniel Avatar asked Dec 07 '25 04:12

Daniel


1 Answers

I managed to make it work! (note: I added some additional fields compared to the screenshot in question. See below for details:

enter image description here

like image 199
Daniel Avatar answered Dec 08 '25 22:12

Daniel



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!