01-30-2020 7:51 AM
Hi,
I have an issue in ODATA 2.0 payload POST request when I try to send decimal value as below,
POST servicName/books
{
"Name": "Scarlet",
"Price": "25.50"
}
error which i am getting is,
{
“error”: {
“code”: null,
“message”: “Error while deserializing payload. An error occurred during deserialization of the entity. A JSON number is not supported as Edm.Decimal value.”
}
}
Price is of type Price: Decimal(13, 3);
Note: I have been using CAP CDS NodeJs for ODATA
Could you please help me how to insert decimal value with ODATA on request payload via json?
03-26-2020 3:05 PM
Not sure about oData 2.0 but For oData 4.0 Post: http://docs.oasis-open.org/odata/odata-json-format/v4.01/odata-json-format-v4.01.html#sec_PrimitiveV...
Add `IEEE754Compatible=true` to the Content-Type Header
01-30-2020 10:51 AM
01-31-2020 5:02 AM
01-31-2020 8:38 AM
02-27-2020 12:29 AM
02-26-2020 9:40 PM
I'm having the same problem given this CDS Data model:
entity FinancedItemsPayments_001{
key ID : UUID;
financedItem : Association to FinancedItems_001;
secuence : Integer;
flagDel : Boolean;
datePro : Date;
datePay : Date;
payAmt : Decimal ( 13, 2);
[...]
}
Raw JSON Request:
{
"secuence": 1,
"flagDel": false,
"datePro": "2020-02-26",
"datePay": "2020-02-26",
"payAmt": "2.00",
"financedItem_ID": "bc9ed4ca-cd8b-419d-a36e-ebb189a9572a",
[...}
}
Response:
{
"error": {
"code": null,
"message": "Error while deserializing payload. An error occurred during deserialization of the entity. A JSON number is not supported as Edm.Decimal value."
}
}
03-26-2020 3:05 PM
Not sure about oData 2.0 but For oData 4.0 Post: http://docs.oasis-open.org/odata/odata-json-format/v4.01/odata-json-format-v4.01.html#sec_PrimitiveV...
Add `IEEE754Compatible=true` to the Content-Type Header
03-26-2020 3:29 PM