json encode/decode data for consistency