stringify before encoding