Hello,
I'm following the tutorial: https://docs.appeon.com/dwconverter2019r3/CRUD_Operations_with_.NET_DataStore/index.html
But when I call the Create method from PowerBuilder 2019 R3 I get the following error message: "JSON value could not be converted to System.Datetime"
I have tested this same function from the "Web API Tester" and it works without problems.
I am working with:
PB and SnapDevelop 2019 R3 Build 2670.
SQL Server 2017.
In PB I use the follow sintax to set the request headers
// Set the Request Headers to tell the Web API you will send JSON data
inv_RestClient.SetRequestHeader ("Content-Type", "application/json;charset=UTF-8")
// Set the Request Headers to accept GZIP compression
inv_RestClient.SetRequestHeader("Accept-Encoding", "gzip")
The client and Web API side are completely new.
Thanks in advance for any help,
Alex
Except perform custom parsing or formatting with the System.Text.Json library
https://docs.microsoft.com/en-us/dotnet/standard/datetime/system-text-json-support#custom-support-for--and-
, there are also two simple solutions:
1) Only modify your ASPNET Core 3.1 Web API project to switch from using the new System.Text.Json package back to using Newtonsoft.Json.
Install-Package Microsoft.AspNetCore.Mvc.NewtonsoftJson.
Then add the following code in Startup.ConfigureServices():
services.AddControllers().AddNewtonsoftJson();
Refer to:
https://docs.microsoft.com/en-us/aspnet/core/migration/22-to-30?view=aspnetcore-3.0&tabs=visual-studio#use-newtonsoftjson-in-an-aspnet-core-30-mvc-project
2) Send DataWindow JSON from your PB application to the Server-side instead of Plain JSON. And use an IDataStore type parameter in your controller to receive data.
I solved it with the first procedure, adding the Microsoft.AspNetCore.Mvc.NewtonsoftJson package (version 3.1.11).
:)