Improved JSON argument handling, and converted console login to use it