refactor play json reads and writes code generation to be more idiomatic