Wash and chop the vegetables into bite-sized pieces.
Dissolve the salt (and sugar, if using) in water to make a brine.
Place the vegetables in a clean glass jar. Add optional spices for flavor.
Pour the brine over the vegetables, ensuring they are fully submerged.
Place a weight on top of the vegetables to keep them under the brine.
Cover the jar with a lid or cheesecloth and place it in direct sunlight for 3–5 days. Stir or lightly press vegetables once a day to release air bubbles.
Taste the pickles after 3 days. Once they reach the desired tanginess, store the jar in the refrigerator to slow fermentation.