Trump sparks UK political row after cancelling London trip
Trump said he was abandoning next month's trip to open the new US embassy because he did not like the location and cost of the building.
But Johnson suggested the decision was prompted by the strong public and political opposition to Trump in Britain, warning that critics "seem determined to put this crucial relationship at risk".
Prime Minister Theresa May offered Trump a state visit to Britain one year ago, when she became the first foreign leader to visit the White House after his inauguration.
But the date has yet to be set in the face of deep hostility to the president in Britain, prompting speculation it could be turned into a lower profile trip focused around the opening of the new embassy.
Trump tweeted overnight that he would not attend the opening, initially scheduled for next month.
"I am not a big fan of the Obama administration having sold perhaps the best located and finest embassy in London for 'peanuts', only to build a new one in an off location for 1.2 billion dollars," he wrote.
"Bad deal. Wanted me to cut ribbon - NO!"
|Many Londoners have made it clear that Donald Trump is not welcome here while he is pursuing such a divisive agenda. It seems he's finally got that message
- Mayor of London Sadiq Khan
'Finally got that message'
His decision was welcomed by critics who deplored the US travel ban on Muslim-majority countries, and more recently, Trump's decision to re-tweet anti-Muslim videos posted by a British far-right organisation.
"Many Londoners have made it clear that Donald Trump is not welcome here while he is pursuing such a divisive agenda. It seems he's finally got that message," tweeted Mayor of London Sadiq Khan.
The mayor, a member of the main opposition Labour party, said there would have been "mass peaceful protests", and that it had been a "mistake" to invite him.
However, Johnson accused Khan and Labour leader Jeremy Corbyn of damaging US-UK relations with their vocal criticism.
"We will not allow US-UK relations to be endangered by some puffed up pompous popinjay in City Hall."
A spokesman for May's Downing Street office said the invitation for the state visit "has been extended and accepted. No date has been confirmed".
He said the embassy opening was a US matter, but said: "The US is one of our oldest and most valued allies and our strong and deep partnership will endure."
The spokesman added that "of course the president would be welcome" to visit London.
Strained UK-US ties
Relations between May and Trump have been strained in recent months, after she condemned his re-tweet of videos by far-right group Britain First in November.
He hit back that she should focus on terrorism in Britain, which suffered five attacks last year.
In December, US ambassador to London Woody Johnson said the new embassy was a "signal to the world that this special relationship that we have is stronger and is going to grow and get better".
He said he was looking forward to welcoming the president to the new embassy, saying: "I think he will be very impressed."
The new 12-storey, cube-shaped building, designed by American architects KieranTimberlake, is located in a regenerated area on the south bank of the River Thames.
Staff moved from their former home in upmarket Mayfair, central London, this week and the new site will be open for business on January 16.
The decision to move was taken by the administration of former Republican president George W. Bush, partly for security reasons following the September 11, 2001, attacks.
Leading Brexit campaigner Nigel Farage, who visited Trump following his election, said the president's decision not to open the building was "disappointing".
"He's been to countries all over the world and yet he's not been to the one with whom he's closest," he said.
But Stephen Doughty, an opposition Labour lawmaker, tweeted: "We are not a big fan of his racist, sexist, unthinking behaviour.
"Big protests if he came to cut ribbon. He wanted the red carpet treatment and cheering crowds - NO!"