79804478

Date: 2025-10-30 07:22:14
Score: 0.5
Natty:
Report link

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"
}
Reasons:
  • Whitelisted phrase (-1): Solution is
  • Long answer (-1):
  • Has code block (-0.5):
  • Me too answer (2.5): face same issue
  • Low reputation (0.5):
Posted by: Satyajit Bhatt