I have the following classs defined:
public class JobTask
{
[AutoId]
public Guid Id { get; set; }
public int Type { get; set; }
[PgSqlJsonB]
public string Config { get; set; }
}
[Route("/api/tasks", "POST")]
public class CreateJobTask
{
public int Type { get; set; }
public string Config { get; set; }
}
Posting from POSTMAN:
{
"type": 1,
"config": {
"name": "test"
}
}
Service:
public async Task<object> Post(CreateJobTask request)
{
try
{
var jobTask = request.ConvertTo<JobTask>();
await Db.InsertAsync(jobTask);
return jobTask.ConvertTo<CreateJobTaskResponse>();
}
catch (Exception ex)
{
throw;
}
}
Error:
22P02: invalid input syntax for type json
What am I missing?