DOJ used powers to legally spy on Journalists and elected members of Congress
We don't know everything about the story, or what led to the Trump admin investigating journalists, because of the US's secrecy (even in its court trials).
Rather than investigating the journalists, they went to the tech companies that had the emails and other information and served them not only a warrant for the information, but a gag order (non-disclosure order). Once the gag orders expired, companies were able to notify the journalists.