Dan Lew Codes
  • Github
Subscribe
Tagged

json

A collection of 2 posts

json

How Trello Android converted from Gson to Moshi

Trello Android recently converted from using Gson to Moshi for handling JSON. It was a bit tricky so I wanted to document the process. (For context, Trello Android primarily parses JSON. We rarely serialize JSON, and thus most of the focus here is on deserializing.) Why Refactor?There were three

Dan Lew Nov 1, 2021 • 4 min read
kotlin

The dangers of JSON + default values

The following code converts an object to JSON and then back again: val adapter = Moshi.Builder().build().adapter(Foo::class.java) val foo = Foo(bar = null) val json = adapter.toJson(foo) val foo2 = adapter.fromJson(json) check(foo == foo2) I think most of us would expect check() to pass, but

Dan Lew Jun 23, 2021 • 2 min read
Dan Lew Codes © 2022
Powered by Ghost