12

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

ligi
  • 39,001
  • 44
  • 144
  • 244

1 Answers1

16

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.

pRaNaY
  • 24,642
  • 24
  • 96
  • 146