diff --git a/include/libcamera/internal/yaml_parser.h b/include/libcamera/internal/yaml_parser.h
index 8c79165659469f65..b92c958f0ec59df4 100644
--- a/include/libcamera/internal/yaml_parser.h
+++ b/include/libcamera/internal/yaml_parser.h
@@ -124,7 +124,7 @@ public:
 	class DictIterator : public Iterator<DictIterator>
 	{
 	public:
-		using value_type = std::pair<const std::string &, const YamlObject &>;
+		using value_type = std::pair<std::string_view, const YamlObject &>;
 		using pointer = value_type *;
 		using reference = value_type &;
 
diff --git a/src/libcamera/yaml_parser.cpp b/src/libcamera/yaml_parser.cpp
index 5ca5fb8235b5e761..555ad03c8dee3f3a 100644
--- a/src/libcamera/yaml_parser.cpp
+++ b/src/libcamera/yaml_parser.cpp
@@ -312,7 +312,7 @@ template std::optional<std::vector<Size>> YamlObject::getList<Size>() const;
  * iteration order is not specified.
  *
  * The iterator's value_type is a
- * <em>std::pair<const std::string &, const \ref YamlObject &></em>.
+ * <em>std::pair<std::string_view, const \ref YamlObject &></em>.
  *
  * If the YamlObject is not of Dictionary type, the returned adapter operates
  * as an empty container.
