add json encode/decode

ok let's start with this merge.