kotlinx-serialization / kotlinx.serialization / SerialDescriptor / getElementIndex

getElementIndex

(common, js, jvm, native) abstract fun getElementIndex(name: String): Int

Returns an index in the children list of the given element by its name or CompositeDecoder.UNKNOWN_NAME if there is no such element. The resulting index, if it is not CompositeDecoder.UNKNOWN_NAME, is guaranteed to be usable with getElementName.

This method may be inconsistent with elementsCount for collection and map types. Refer to its documentation for more details.