Decode a JSON encoded command /w tests.

Also refactor reading from log file.