Add a framewowrk for parsing and creating json commands.

Initial prototype for one command mostly from jrick, with discussion
with me and jcv.  Other commands mocked up in a couple of long boring days by
yours truly.

Code isn't fully tested yet so may well still be buggy in the type conversions.
Test will be added over the next few days to get this up to snuff.