Jennifer Lopez and Alex Rodriguez are determined to make their impending marriage work — thanks to some help from a Supreme Court Justice.

Ruth Bader Ginsburg — who recently completed treatment for pancreatic cancer — said Saturday at the National Book Festival that Lopez, 50, and Rodriguez, 44, asked her for relationship advice.

"I was called up about a month or so ago by Jennifer Lopez, and she said she would like to meet me and introduce her fiance Alex Rodriguez," she recalled. "So they came to chambers, and we had a very nice visit. She mostly wanted to ask if I had any secret about a happy marriage. But now, A-Rod is traveling with her to concerts all over the world."

JENNIFER LOPEZ, ALEX RODRIGUEZ DOWNPLAY 'TENSION' RUMORS

Jennifer Lopez and Alex Rodriguez asked Supreme Court Justice Ruth Bader Ginsburg for marriage advice. The couple got engaged in spring 2019.

Jennifer Lopez and Alex Rodriguez asked Supreme Court Justice Ruth Bader Ginsburg for marriage advice. The couple got engaged in spring 2019. (Getty)

ALEX RODRIGUEZ SAYS JENNIFER LOPEZ WAS HIS 'DREAM DATE' IN 1998 INTERVIEW

Ginsburg, 86, was married to husband Marty for more than 50 years until his death in 2010. She says that her own mother-in-law gave her great marriage advice on her wedding day.

"On the day I was married, my mother-in-law — I was married in her home — she took me aside and said she wanted to tell me the secret of a happy marriage," Ginsburg said.

What were the wise words?

She said with a chuckle that her mother-in-law told her, "It helps sometimes to be a little deaf."

JENNIFER LOPEZ SAYS SHE AND ALEX RODRIGUEZ ARE TOO BUSY TO GET MARRIED JUST YET

ALEX RODRIGUEZ ADMITS HE PRACTICED J.LO PROPOSAL ON HIS ASSISTANT TO MAKE SURE IT WAS PERFECT

On Monday, Ginsburg received an honorary law degree from the University of Buffalo in New York. It was her first public appearance since completing cancer treatment.

Ginsburg is a leader of the Supreme Court's liberal wing and has earned the nickname "Notorious RBG."

RUTH BADER GINSBURG MARVELS AT ‘NOTORIOUS RBG’ NICKNAME AFTER GETTING HONORARY LAW DEGREE

"It was beyond my wildest imagination that I would one day become 'Notorious RBG.' I am now 86 years old, yet people of all ages want to take their picture with me — amazing," she said Monday in New York.

Rodriguez popped the question to Lopez in March 2019 after about two years of dating.

CLICK HERE TO GET THE FOX NEWS APP

The couple have reportedly not set a wedding date.

Fox News' Louis Casiano and Melissa Leon contributed to this report.