Drain the pineapple and collect the juice. Cut the pineapple into small pieces. Peel onion and chop finely. Heat oil in a pot. Sauté the onion in it. Add the pineapple and juice and let it boil down for 25-30 minutes at low heat while stirring.
Season to taste with salt, chilli and vinegar. Garnish with a chilli pepper if desired.