Parbad
Parbad copied to clipboard
JsonSerializationException when using ZarinPal gateway
Bug description (wIthout specifiing the sensitive data) When I updated Parbad.Gateway.ZarinPal to latest version (1.3.0), I got this error in Parbad library without changing any code.
POST https://api.zarinpal.com/pg/v4/payment/request.json [200]
Newtonsoft.Json.JsonSerializationException: Cannot deserialize the current JSON array (e.g. [1,2,3]) into type 'Parbad.Gateway.ZarinPal.Internal.ZarinPalRequestResultModel' because the type requires a JSON object (e.g. {"name":"value"}) to deserialize correctly.
To fix this error either change the JSON to a JSON object (e.g. {"name":"value"}) or change the deserialized type to an array or a type that implements a collection interface (e.g. ICollection, IList) like List<T> that can be deserialized from a JSON array. JsonArrayAttribute can also be added to the type to force it to deserialize from a JSON array.
Path 'data', line 1, position 9.
Package name and version
- Parbad: 3.8.3
- Parbad.AspNetCore: 1.2.0
- Parbad.Gateway.ZarinPal: 1.3.0
- Parbad.Storage.EntityFrameworkCore: 1.3.1
Web application type:
- ASP.NET CORE
I'll take a look at it soon
same error here :
Cannot deserialize the current JSON array (e.g. [1,2,3]) into type 'Parbad.Gateway.ZarinPal.Internal.ZarinPalRequestResultModel' because the type requires a JSON object (e.g. {\"name\":\"value\"}) to deserialize correctly.\r\nTo fix this error either change the JSON to a JSON object (e.g. {\"name\":\"value\"}) or change the deserialized type to an array or a type that implements a collection interface (e.g. ICollection, IList) like List<T> that can be deserialized from a JSON array. JsonArrayAttribute can also be added to the type to force it to deserialize from a JSON array.\r\nPath 'data', line 1, position 9.
I debugged the Parbad library and caught the reason of error
the error thrown from Zarinpal api as internal server error (500)
I will try to contact Zarinpal support