嗨,我想知道一旦对象被序列化,如何映射POST API模型中的字段?我似乎搞不懂,请看下面的代码,我已经解决了序列化,可以在控制台中显示我的SQL查询的结果,但是如何将它们映射到应该在API中填充的字段?map the products to their respective fields from the SQL Database to the API*/
Console.WriteL
我正在c#中测试一些api调用,并获得以下JSON响应: "message": "The request is invalid. Model validation failed."A customer must be added to the order before it can be placed." }}
我想将这个响应映射到一个带有JSON反序列化器的类,并且我无法控制响
我使用Kotlin data classes和GSON反序列化JSON模式,并实现默认值以防止JSON中的空对象。--在字段匹配已知枚举的情况下,或者如果JSON中完全没有字段,这很有效,在这种情况下,默认枚举将被实现。但是-如果在JSON 中接收到的枚举没有映射到kotlin枚举中已知的枚举值-则反序列化枚举的结果将为null