reorganized how I handle json on the server