A commonly seen method to provide spring action in a 3D printed model is to use a series of curved and straight segments. Some of the designs use the segment assembly in compression, aligned with the plane of the print, while others use the segment assembly for springiness perpendicular to the plane of the print.
An example of the latter is a squishy turtle from Thingiverse resulting in four legs that provide some bounce to the turtle if dropped from a small height. This video shows the movement of the legs more clearly, as there were no suitable still photos available on the site.
The image below shows another spring type print from Thingiverse in which the forces are in line with the print plane.

The S-curves cannot be too thick or movement will be severely limited, and too thin means impossible to print and possibly reduced lifespan.
Many designs abound with a search of the 'net for "3D printed springs."