- adding checks before uploading to server
- added json_encode

Signed-off-by: Siddhartha Gupta <makerzzz.zzzz@gmail.com>