Nothing in 1 John contradicts Christ. John specifically warns us against walking in darkness - sinful disobedience. That would include violating Christ’s command against divorce and remarriage.
“Nothing in 1 John contradicts Christ.”
You are correct;
“If we confess our sins, he is faithful and just and will forgive us our sins and purify us from all unrighteousness.”
He is not contradicted here at all. I believe this particular passage to be one of the greatest gifts from God that there is in the Holy Bible. Especially since we are fallen man that can in no way be deserving of Heaven on our own and are all in need of His grace.