json and better encoding