The 50-year-old actor said on Monday's episode of Good Morning America he hoped to pay homage to Williams, who voiced Genie in the 1992 animated Disney film, while bringing "new flavor" to the role in the live-action remake.
"The only thing that I latched onto was the idea that it was going to be live action ... I knew that left a little bit of room," he said. "He revolutionized what you could do in these types of films. He really changed using modern references and things like that."
Smith said he listened to the original soundtrack and used hip hop to put a fresh spin on the character.
"I could pay homage to Robin, but then also be able to add my new flavor," he said. "This is the most fun I've ever had making a movie."
"You know, I've made some good movies and I've made some questionable ones," he said. "This one, this is such a beautiful, beautiful movie. Guy Ritchie did a great job. There's such an edge to it. I can, in good conscience, encourage you to go see this one."
The original Aladdin featured the voices of Williams, who died at age 63 in August 2014, Scott Weinger and Linda Larkin. The live-action remake stars Smith, Mena Massoud and Naomi Scott, and opens in theaters May 24.
Aladdin released a new TV spot trailer featuring Aladdin and Jasmine in April.