{"id":1555,"library":"microsoft-kiota-serialization-text","title":"Kiota Text Serialization","description":"This library provides core serialization and deserialization capabilities for plain text (`text/plain`) within the Microsoft Kiota ecosystem for Python. It allows Kiota-generated API clients to handle text-based responses and requests. The current version is 1.10.1, and releases are frequent, synchronized with the broader Kiota project across multiple languages.","status":"active","version":"1.10.1","language":"en","source_language":"en","source_url":"https://github.com/microsoft/kiota-python","tags":["microsoft","kiota","serialization","text","api-client"],"install":[{"cmd":"pip install microsoft-kiota-serialization-text","lang":"bash","label":"Install library"}],"dependencies":[{"reason":"Provides the core interfaces for serialization and deserialization, which this library implements.","package":"microsoft-kiota-abstractions"}],"imports":[{"symbol":"TextSerializationWriterFactory","correct":"from microsoft_kiota_serialization_text import TextSerializationWriterFactory"},{"symbol":"TextParseNodeFactory","correct":"from microsoft_kiota_serialization_text import TextParseNodeFactory"}],"quickstart":{"code":"from microsoft_kiota_serialization_text import TextParseNodeFactory, TextSerializationWriterFactory\n\n# Instantiate the factory for text serialization\nwriter_factory = TextSerializationWriterFactory()\nwriter = writer_factory.get_serialization_writer('text/plain')\n\n# Serialize a string value\nwriter.write_str_value(None, 'Hello from Kiota!')\nserialized_content = writer.get_serialized_content() # Returns bytes\nprint(f\"Serialized (bytes): {serialized_content}\")\nprint(f\"Serialized (str): {serialized_content.decode('utf-8')}\")\n\n# Instantiate the factory for text deserialization\nparser_factory = TextParseNodeFactory()\nparser = parser_factory.get_parse_node('text/plain', serialized_content)\n\n# Deserialize the string value\ndeserialized_value = parser.get_string_value()\nprint(f\"Deserialized: {deserialized_value}\")","lang":"python","description":"This quickstart demonstrates how to use `TextSerializationWriterFactory` to serialize a string to bytes and `TextParseNodeFactory` to deserialize those bytes back into a string, explicitly handling the 'text/plain' content type."},"warnings":[{"fix":"Upgrade your Python environment to version 3.10 or newer.","message":"Support for Python 3.9 was dropped starting from version 1.10.0. Ensure your environment uses Python 3.10 or higher.","severity":"breaking","affected_versions":">=1.10.0"},{"fix":"Use the appropriate Kiota serialization library for the content type you are handling (e.g., `microsoft-kiota-serialization-json` for JSON).","message":"This library specifically handles `text/plain` content. Attempting to use its factories with other content types (e.g., `application/json`, `application/xml`) will result in errors or incorrect parsing, as it lacks the necessary logic for those formats.","severity":"gotcha","affected_versions":"All"},{"fix":"Register factories using `SerializationWriterFactoryRegistry.default_instance.register_content_type('text/plain', TextSerializationWriterFactory)` and `ParseNodeFactoryRegistry.default_instance.register_content_type('text/plain', TextParseNodeFactory)`.","message":"For full integration within the Kiota request adapter pipeline, you must register `TextSerializationWriterFactory` and `TextParseNodeFactory` with `SerializationWriterFactoryRegistry.default_instance` and `ParseNodeFactoryRegistry.default_instance` respectively. Without registration, the default Kiota request adapter might not automatically pick up these factories for 'text/plain' content.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-04-09T00:00:00.000Z","next_check":"2026-07-08T00:00:00.000Z"}