add function for making json and sql