Yes John the Baptist was Jesus relative that that got his head cut off . John the Apostle was inspired to write four (4) books in the Bible. But also John the Apostle was the last member of Jesus Apostles to die, John the apostle worte the last book in yhe Bible, Revelation.
There are many men named John who are mentioned in the Bible. Here is scriptural information on the two you mentioned.
* John the Baptist, son of Zechariah and Elizabeth.—Mark 1:4; Luke 1:57-60. this one was also Jesus cousin, he was six months older then Jesus. He also baptised Jesus in the the Jordan river.
* The apostle John, “the son of Zebedee.” (Matthew 10:2) This apostle wrote the Gospel of John; the letters entitled the First, Second, and Third of John; and the book of Revelation.
Addition info: (jw.org)