completed the form JSON generator function