Moshi ignore field

ligi picture ligi · Mar 24, 2016 · Viewed 8.3k times · Source

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

Answer

pRaNaY picture pRaNaY · Mar 28, 2016

Use transient on the field declaration.

private transient String your_variable_name;

Originally I found Exclude fields from serialization and deserialization

Hope It's help you.