JsonVariantConst is a read-only version of JsonVariant. Like JsonVariant, it points to a variant in a JsonDocument. The difference is that JsonVariantConst provided only read access to the variant and doesn’t allow modifying the value. It’s also twice smaller because it doesn’t contain a pointer to the memory pool.

Use this JsonVariantConst in place of JsonVariant when you want to enforce immutability or when you work with a const JsonDocument.

Member functions

JsonVariantConst also support the comparison operators ==, !=, <, <=, >, and >=.

See also