J. William Ditter (DM 31) was launched as DD 751 by Bethlehem Shipbuilding Co., Staten Island, New York on 4 July 1944; sponsored by Mrs. J. William Ditter, widow of Congressman Ditter; reclassified DM 31 on 19 July 1944; and commissioned at the New York Navy Yard on 28 October 1944, Comdr. R. R. Sampson in command.

J. William Ditter completed her shakedown off Bermuda in December. She sailed from Norfolk on 13 January 1945, and after transiting the Panama Canal and touching at San Diego arrived at Pearl Harbor on 10 February.

As the Navy’s island-hopping thrust toward Japan reached its climax, J. William Ditter sailed on 2 March for Eniwetok and Ulithi, departing the latter base on 19 March for Okinawa. She arrived on 25 March off the critical island, soon to be the scene of the largest amphibious assault of the Pacific war, and began hazardous minesweeping operations. The next day she skillfully dodged a torpedo during an encounter with a Japanese submarine. On 29 March she discovered two suicide boats off Okinawa, and sank one of them with gunfire. By the day of the invasion, 1 April, J. William Ditter and her sister mine craft had swept the channels and laid marker buoys, contributing importantly to the success of the initial landing. Next day her duties shifted to convoy escort, as the versatile ship protected transports on night retirement away from Okinawa. On the night of 2 April, the ship shot down two bombers. She continued to come under air attack in the days that followed as the Japanese made a desperate but futile effort to stop the invasion with kamikaze tactics.

J. William Ditter was assigned to radar picket duty on 12 April, and subsequently became the target of heavy air attack. She shot down several planes and assisted with several more until retiring to Kerama Retto 30 April. The ship was soon back on picket duty, however, and engaged in numerous battles with Japanese aircraft.

While patrolling with Harry F. Bauer and Ellyson on 6 June, J. William Ditter was attacked by a large group of kamikazes. The ship’s gun crews downed five of the planes but a sixth glanced off her No. 2 stack and another crashed her on the port side near the main deck. The ship lost all power and suffered many casualties; but valiant damage control kept her afloat until she could be towed by tug Ute to Kerama Retto next day. Eventually she was repaired enough to steam to Saipan on 10 July and begin the long voyage home. She touched at San Diego and the Canal Zone before arriving at New York on 12 July 1945. J. William Ditter decommissioned there 28 September 1945 and was scrapped in July 1946.

J. William Ditter received one battle star for World War II service.