Tidy up json parsing.

Also renamed internal use of 'json' variable to 'config'; did not
touch the commandline arguments yet.

Change-Id: I624b1f477fbcb356bb719fd0b5749aa8bcc93a64