We know that we have come to know Him if we keep his commands. Whoever says "I know him" but does not do what he commands is a liar, and the truth is not in them.
Taken out of context, this could easily be misconstrued: we only get to be close to God if we do what he says; acceptance is conditional on obedience; I will only love you if...
And yet God loves us. God loves us because it it who he is. He loves us because he loves us because he loves us. He cannot not love us. We do not obey him in order to earn affection from him. But that does not let us off the hook. John is quoting Jesus here (Matthew 7:21-23). There is a distinction between knowing and knowing. Between those who claim to follow Jesus and call him Lord and those who really do follow him, who really do know him. Jesus is saddened by Philip because he does not know him, does not trust him even after he has spent so much time together; even after Jesus has proved his trustworthiness and his worth. (John 14:9) If we really know Jesus intimately - the word used here is the word that Mary uses to describe not knowing a man (Luke 1:34) - if we are convinced by the goodness of his character and the truth of his claims, if we have fallen in love with this man who is God then we will do what he says.
And we will do it because what he says is not burdensome. (1 John 5:3) His commands are not the heavy yokes of the Pharisees (Matthew 23:4) which cannot be carried; they are not legalistic nitpickings or the whims of a tyrant; they are the loving instructions of the one who longs all things for our good, and who would have us live in complete fullness. (John 10:10) We will keep his commands because we love him and because we are confident in his love for us. (John 14:15; 21; 23) We will keep his commands because to do so is to stick with him, to remain in him, to stay close by (John 15:9).
What then is it that we are commanded to do? I once tried to write down all the commands of Jesus in the gospels. We are told to teach others to obey everything that Jesus commanded us to do (Matthew 28:18-20), and so what have we been commanded? And the thing is that it's simple, ridiculously simple, and painfully hard: his command is this: love. (John 15:12) Love God. Love others. (Luke 10:27) Love sacrificially. (John 15:13) Love patiently, kindly, humbly, selflessly. Love without counting the cost. Love protectively, trustingly, hopefully, naively. (1 Corinthians 13) Love those who hurt you before and will hurt you again. Love unfailingly. Love your enemies, love your brothers and sisters who wind you up within the church and without, love those you don't get on with and don't agree with. Love and keep loving when you think you can't love any more. Love to the point of death. Love like He did. (John 15:12)
And here's the rub: it is impossible to love like he did without knowing him. Without knowing the awesome, extravagant, ridiculous love of the cross for ourselves we cannot emulate it. (1 John 4:7-8) We will soon run dry and burn out. We can only love to the measure that we know that we are loved. And so Paul prays, and so I pray for myself today: that I would be rooted and established in love. That I would grasp how high and deep and wide and long is the love of Jesus. That I would know the love that surpasses knowledge and be filled up to the measure of all the fullness of God. (Ephesians 3:16-19)
The rest is overflow.