Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
quran:3:29

Say, "Whether you conceal what is in your breasts or reveal it, Allah knows it. And He knows that which is in the heavens and that which is on the earth. And Allah is over all things competent.  

Say, to them: ‘Whether you hide what is in your breasts, in your hearts, of patronage to them, or disclose it, manifest it, God knows it and, He, knows what is in the heavens and what is in the earth; and God is Able to do all things, and this includes punishing those who patronise them.
القرآن:٣:٢٩

قُلْ إِنْ تُخْفُوا مَا فِي صُدُورِكُمْ أَوْ تُبْدُوهُ يَعْلَمْهُ اللَّهُ ۗ وَيَعْلَمُ مَا فِي السَّمَاوَاتِ وَمَا فِي الْأَرْضِ ۗ وَاللَّهُ عَلَىٰ كُلِّ شَيْءٍ قَدِيرٌ  

{قل} لهم {إن تخفوا ما في صدوركم} قلوبكم من موالاتهم {أو تبدوه} تظهروه {يعلمْه الله و} هو {يعلم ما في السماوات وما في الأرض والله على كل شيء قدير} ومنه تعذيب من والاهم.

See similar narrations below:

Collected by Qurʾān
quran:49:16

Say, "Would you acquaint Allah with your religion while Allah knows whatever is in the heavens and whatever is on the earth, and Allah is Knowing of all things?"  

Say, to them: ‘Do you ˹pretend to˺ inform God about your religion (read the doubled ˹2nd verbal˺ form atu‘allimūna, ‘do you inform’), in other words, are you intimating to Him your ˹religious˺ status when you say, ‘We believe’, when God knows all that is in the heavens and all that is in the earth, and ˹even though˺ God is Knower of all things?’
القرآن:٤٩:١٦

قُلْ أَتُعَلِّمُونَ اللَّهَ بِدِينِكُمْ وَاللَّهُ يَعْلَمُ مَا فِي السَّمَاوَاتِ وَمَا فِي الْأَرْضِ ۚ وَاللَّهُ بِكُلِّ شَيْءٍ عَلِيمٌ  

{قل} لهم {أتعلمون الله بدينكم} مضعف علم بمعنى شعر، أي أتُشْعِرونه بما أنتم عليه في قولكم آمنا {والله يعلم ما في السماوات وما في الأرض والله بكل شيء عليم}.