Reporting what you heard someone say is the literal definition of hearsay.
If you want to use someone saying something as evidence in court, they need to say it to the court as directly as is practical. If the person saying it isn't going to say it directly to the court, then it needs to be justified with one of the exceptions to the hearsay rule.
In this example, it would be allowed because the person saying it wouldn't be willing to admit to a crime in court.
Reporting what you heard someone say is the literal definition of hearsay.
If you want to use someone saying something as evidence in court, they need to say it to the court as directly as is practical. If the person saying it isn't going to say it directly to the court, then it needs to be justified with one of the exceptions to the hearsay rule.
In this example, it would be allowed because the person saying it wouldn't be willing to admit to a crime in court.