Prevent malformed JSON in analytics