Cleanup and json

Cleaned up web_input(),
added format_json()
figuring out logic and json saving