1) bitwise 'and' is used intead of logical 'and' to truncate unsigned char to 8 bits;
2) an iterator-based approach is used to append escaped JSON strings.