This is described in the later parts of the Ramayana. After Lord Rama came back from his vanavasa of 14 years and winning over Lanka Naresh Ravana, he was coronated as Ayodhya Naresh – the King of Ayodhya.
In the celebration, precious ornaments and gifts were distributed to everyone. Hanuman was also gifted a beautiful necklace of diamonds by Sita – the wife of Rama. Hanuman took the necklace, carefully examined each and every diamond, pulled them apart, and threw them away.
Most were surprised by his behaviour. When asked as to why he was throwing away the precious diamonds, he replied that he couldn’t find Rama in any one of them. Thus, they carried no worth to him since anything in which there is no Rama is without worth.
When asked if Lord Rama was in Hanuman himself, he tore his chest apart to reveal his heart. The on-lookers, now convinced of his genuine devotion, saw the image of both Rama and Sita appearing on his heart.