Jehoshaphat slept with his ancestors and was buried with his ancestors in the city of David; his son Jehoram succeeded him. He had brothers, the sons of Jehoshaphat: Azariah, Jehiel, Zechariah, Azariah, Michael, and Shephatiah; all these were the sons of King Jehoshaphat of Judah. Their father gave them many gifts, of silver, gold, and valuable possessions, together with fortified cities in Judah; but he gave the kingdom to Jehoram, because he was the firstborn. When Jehoram had ascended the throne of his father and was established, he put all his brothers to the sword, and also some of the officials of Israel. (2 Chronicles 21:1-4, NRSV)
Jehoshaphat slept with his fathers, and was buried with his fathers in the city of David. And Jehoram his son reigned in his stead. And he had brethren the sons of Jehoshaphat, Azariah, and Jehiel, and Zechariah, and Azariah, and Michael, and Shephatiah: all these were the sons of Jehoshaphat king of Israel. And their father gave them great gifts of silver, and of gold, and of precious things, with fenced cities in Judah: but the kingdom gave he to Jehoram; because he was the firstborn. Now when Jehoram was risen up to the kingdom of his father, he strengthened himself, and slew all his brethren with the sword, and divers also of the princes of Israel. (2 Chronicles 21:1-4, KJV)
Apparently rules of family descent didn't mean you had to like your family. Once the requirement was fulfilled—i.e., a Davidic king was on the throne—the other brothers are dispatched. This obviously wasn't what Jehoshaphat had in mind because he made bequests to all his sons. The favored firstborn is a theme throughout the Bible, but it's just as often turned upside-down, like when Jacob stole the birthright from Isaac or when Joseph ended up as way more powerful than all his older brothers. Some of the Davidic kings are firstborns and others aren't, for a variety of reasons.