Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Moshi ignore field

Tags:

json

moshi

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

like image 260
ligi Avatar asked Mar 24 '16 15:03

ligi


1 Answers

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.

like image 155
pRaNaY Avatar answered Oct 12 '22 10:10

pRaNaY