Put outJson var within if/else statement