I proprose writing a wrapper function for these 3 calls that does it all directly:

let buf = extra::json::memory_encoder(m)