JSONSerialization Invalid type in JSON write (_SwiftValue)

前端 未结 10 923
情书的邮戳
情书的邮戳 2020-12-14 14:14

Why does the following code give me the error:

Invalid type in JSON write (_SwiftValue).

The error is thrown on this line:

10条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-14 14:25

    I had this problem and it was because one of my strings was Optional. It was trying to serialize a value like: "Optional(\"string value\")"

    Instead of "string value"

提交回复
热议问题