Solution is very simple. You just need to follow step by step class attributes with it's required types. As per your request, you are facing an issue regarding JSON Parse Error. You just need to use long value instead String value. Because, in your ProductMaterial class you are using long type and here you are using String value. So, this is the main issue. Just use necessary data type value with id and try again with same request, you will not face same issue again.
Your request :
Your JSON :
{
"sku": "PRD-001",
"name": "Test Produkt",
"materials": [
{
"id": -1,
"material": {
"id": "52a92362-3c7b-40e6-adfe-85a1007c121f",
"description": "Material 1",
"costPerUnit": 1,
"inStock": 1
},
"unitsPerProduct": 1
},
{
"id": -1,
"material": {
"id": "8a0d57cc-d3bd-4653-b50f-d4a14d5183b3",
"description": "Material 4",
"costPerUnit": 0.25,
"inStock": 4
},
"unitsPerProduct": 1
}
],
"sellPrice": "1.2"
}
New Sample JSON (Try and Check) :
{
"sku": "PRD-001",
"name": "Test Produkt",
"materials": [
{
"id": -1,
"material": {
"id": 1,
"description": "Material 1",
"costPerUnit": 1,
"inStock": 1
},
"unitsPerProduct": 1
},
{
"id": -1,
"material": {
"id": 2,
"description": "Material 4",
"costPerUnit": 0.25,
"inStock": 4
},
"unitsPerProduct": 1
}
],
"sellPrice": "1.2"
}