Japan considered a mediated peace with the Western Allies with the Soviet Union acting as an intermediary, but refused surrender and an occupation of the country. The bombs were initially supposed to be used on Japan as a tactical weapon in conjunction with the planned invasion (and the Soviet invasion of Manchuria was supposed to tie down Japanese troops there while the Allies invaded Japan), but the Americans decided to use them to break the Japanese resolve and shock them into surrender rather than the costly measure of invading the country since decrypts revealed that the Japanese were debating amongst themselves as to what to do. People seem to forget or not realize that the Japanese wanted to continue fighting AFTER the bomb on Hiroshima was dropped, and that those who wanted to continue fighting and repel the anticipated Allied invasion unsuccessfully attempted to overthrow the government AFTER the Soviets broke off relations and invaded Manchuria (with the second bomb being dropped on Nagasaki later the same day) and AFTER the Emperor broke the deadlock and told the Cabinet to accept the Potsdam terms (and AFTER his speech explaining to the Japanese people why they had to surrender, which alluded to the atomic bombs and NOT to the Soviet invasion as the reason).
And I love how people cherry-pick the dropping of atomic bombs on Japan, and conveniently ignore every other atrocity that went on during the war (especially Japan's savage conduct and brutal occupation in this context), the circumstances that lead to the bombs being used, their impact on bringing a bitter conflict to a relatively quick end without "an Okinawa from end of Japan to the other", how the impact of the bombs wasn't fully understood at the time like it was later on, and how there was still bitter fighting against large numbers of Japanese troops throughout Asia until the end of the war in the Pacific. So many of us would rather project our prejudices onto history rather than see it for what it is. Had any other nations developed nuclear weapons before the U.S., they surely would have used them. The Japanese should have surrendered unconditionally when they had the chance -- what else would you have proposed to have been done against an aggressive, militaristic enemy that refused to surrender unconditionally, when blockading and aerial bombardment was not changing their minds, and after great sacrifice you possess a weapon that could end the war without further great losses to either side and change warfare forever?