refactor, output json