Refactor json structure