0

我正在使用 PostgREST 7,并想在 PostgreSQL 中进行简单的插入。我的字段之一是 JSON 字符串,将其插入请求的 JSON 正文会破坏 PostgREST 上的解析。

作为使用简单 JSON 字段的示例,请求如下:

curl -k -X POST --header Content-Type: application/json --header Accept: application/json --header Authorization: Bearer asdkfsldkfjsa;kfd;fdj -d {"imagenumber":"12345678", "imagename":"name", "imageversion":"1.0.4.344", "seriousVulnerabilityFound":"false", "report":"{scanResult:{3842483d3c94:{imageId:384241234594,imageSummary:{pass:true}}}}"

是否有一种支持的方式来编码将在 PostgREST 上解码的 JSON 字符串字段,以便该字段可以作为 JSON 列插入 PG 中?

4

1 回答 1

0

中的值report是无效的 json。不要引用它并将其更改为有效的 json:

{"report": {"scanResult":{"3842483d3c94":{"imageId":384241234594,"imageSummary":{"pass":true}}}}}
于 2020-09-25T19:12:21.607 回答