Rinse the cranberries in cold water and remove any stems or damaged berries. Place them in a large pot.
Add the diced apples, granulated sugar, brown sugar, orange juice, and orange zest to the pot. Stir until well combined.
Place the pot over medium heat and allow the mixture to cook, stirring occasionally. Once the cranberries start to pop, reduce the heat to low.
Add the ground cinnamon, nutmeg, allspice, and lemon juice to the pot. Continue to simmer for about 30-35 minutes, stirring frequently to prevent sticking, until the mixture has thickened to a jam-like consistency.
If using, stir in the chopped pecans for added texture.
Once the jam has thickened, remove it from heat and let it cool slightly.
Transfer the jam into sterilized jars while still warm, then seal with lids. Allow the jars to cool completely at room temperature before refrigerating.