# What is the best way to detect specific unboxed (primitive) arrays in kotlinx-serialization?

**URL:** https://discuss.kotlinlang.org/t/what-is-the-best-way-to-detect-specific-unboxed-primitive-arrays-in-kotlinx-serialization/21015
**Category:** Support
**Created:** [February 28, 2021, 5:22pm UTC](https://discuss.kotlinlang.org/t/what-is-the-best-way-to-detect-specific-unboxed-primitive-arrays-in-kotlinx-serialization/21015 "2021-02-28T17:22:52Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![raphael.tarita](https://avatars.discourse-cdn.com/v4/letter/r/3ab097/32.png) [@raphael.tarita](https://discuss.kotlinlang.org/u/raphael.tarita)
#### Post date: [February 28, 2021, 5:22pm UTC](https://discuss.kotlinlang.org/t/what-is-the-best-way-to-detect-specific-unboxed-primitive-arrays-in-kotlinx-serialization/21015/1 "2021-02-28T17:22:52Z")

</div>

Hi all,

I’ve been working on a custom kotlinx-serialization format for a while now. Currently, I’m looking for a good way to detect primitive array types in the encoding process. The problem is:

- KXS handles all collection-like formats as `StructureKind.LIST`, which is fine so far because it handles the serialization / deserialization from / into the actual type for you.
- The format I’m implementing has dedicated types for Byte, Int and Long Arrays.
- Therefore, I’d like to treat `StructureKind.LIST` elements differently if they are actually representing one of `ByteArray`, `IntArray` and `LongArray`.

So: What is the best way to get that kind of information out of a `SerialDescriptor`?

Thank you!
