def validate_answer(self, value):
<EOL>try:<EOL><INDENT>serialized = json.dumps(value)<EOL><DEDENT>except (ValueError, TypeError):<EOL><INDENT>raise serializers.ValidationError("<STR_LIT>")<EOL><DEDENT>if len(serialized) > Submission.MAXSIZE:<EOL><INDENT>raise serializers.ValidationError("<STR_LIT>")<EOL><DEDENT>return value<EOL>
Check that the answer is JSON-serializable and not too long.