莫西无视场 [英] Moshi ignore field
本文介绍了莫西无视场的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在使用moshi序列化为json字符串时,是否有一种简单的方法可以忽略字段?我只能想到的是自定义适配器-但我觉得有更好的方法
Is there a simple way to ignore a field when using moshi to serialize to a json string? I can only think about is a custom adapter - but I have the feeling that there is a better way
推荐答案
在字段声明中使用transient
.
private transient String your_variable_name;
最初,我发现从序列化和反序列化中排除字段
希望对您有帮助.
这篇关于莫西无视场的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文