Peel and remove cores of pineapples and roughly cut into small 3cm to 4cm pieces. Blend the pineapple pieces in a food processor until you get a coarse puree.
Place the pineapple puree and spices into a non-stick wok, bring to a boil and cook on medium heat for 20 minutes to reduce the pineapple juice.
Add in the caster sugar or agave sugar, stir and combine well, bring to a boil again. Then simmer on low heat, stirring occasionally, for 1 hour or until the pineapple jam has become a darker golden colour and has just thickened or until setting point is achieved. Stir frequently towards the last stage of cooking to prevent the jam from burning. Set aside and allow to cool.
Once the pineapple jam has cooled down, remove the spices and store in a glass jar in the refrigerator.