add JSON encode/decode

mainly for exchanging complex data structures with remote command
client