handle empty json arg properly, and transpose encode/decode parity