In legal terms, "legality of object" refers to the requirement that the purpose or object of a contract must be lawful. If the object involves something illegal or against public policy, the contract may be considered void.
"Consideration" in a contract refers to something of value exchanged between parties, typically money, goods, or services. For a contract to be valid, there must be mutual consideration – both parties must give up something of value.
In essence, both the object and consideration of a contract must be legal for the contract to be enforceable.