Json encoder refactor take6