Extract common functions into ppx_deriving_yojson.runtime.