0

I wanted to ask for certain if this is legal in Moshi to have two adapters on one Moshi - I'm not getting errors, but I found on some devices there is a problem:

Moshi moshi = new Moshi.Builder()
                .add(new CallLogJsonAdapter())
                .add(new ContactJsonAdapter())
                .build();
jean d'arme
  • 4,033
  • 6
  • 35
  • 70

1 Answers1

2

Moshi permits as many adapters as you need. In the unusual event that multiple classes adapt the same type, the one you add first takes precedence.

Jesse Wilson
  • 39,078
  • 8
  • 121
  • 128
  • Where is this documented that the order matters? Seems like a big issue on Kotlin if you are using KotlinJsonAdapterFactory(). – toby yeats May 25 '20 at 22:06