'Strapi - Validation Error 400 this must be a `object` type, but the final value was: `null`
I am trying to post a json to my Strapi API, but I got this error "this must be a objecttype, but the final value was:null
My Json data is:
{
"data": [
{
"cveID": "CVE-2021-27104",
"vendorProject": "Accellion",
"product": "FTA",
"vulnerabilityName": "Accellion FTA OS Command Injection Vulnerability",
"dateAdded": "2021-11-03",
"shortDescription": "Accellion FTA 9_12_370 and earlier is affected by OS command execution via a crafted POST request to various admin endpoints.",
"requiredAction": "Apply updates per vendor instructions.",
"dueDate": "2021-11-17"
},
{
"cveID": "CVE-2021-27102",
"vendorProject": "Accellion",
"product": "FTA",
"vulnerabilityName": "Accellion FTA OS Command Injection Vulnerability",
"dateAdded": "2021-11-03",
"shortDescription": "Accellion FTA 9_12_411 and earlier is affected by OS command execution via a local web service call.",
"requiredAction": "Apply updates per vendor instructions.",
"dueDate": "2021-11-17"
}]
}
Solution 1:[1]
Seems that in Python you need first to do your serialization and then fetch it in Strapi
json_string = json.dumps(to_post)
data = json.loads(json_string)
Solution 2:[2]
You are sending an array remove the [] and your post will work.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | |
| Solution 2 | Mausaille |

