Only expect JSON when specified.

also catch any errors with parsing JSON.

loginJSON is now a possible config value in regex.conf