prevent duplicate output with json flag

was printing two lines for every line