Help articles

Array contains multiple types that resolve to the same JSON type

This warning appears when you have an array type where multiple members resolve to the same underlying JSON type (e.g., both string and text resolve to JSON type "string"). When Sanity stores array data, it uses the JSON type to serialize values. If multiple array members share the same JSON type, Sanity cannot distinguish between them at runtime. For example, if an array allows both string and text items, there's no way to know which type a given string value was originally intended to be when reading the data back.

Example of problematic schema

Both string and text (as well as url and email) resolve to the JSON type "string". This means we have no way to tell them apart when the document is read.

How to fix

You have two options:

  • Option 1: Use only one primitive type per JSON typeIf you only need one string-based type in your array, remove the duplicate:
  • Option 2: Wrap primitives in object typesIf you need different string-based inputs with different behaviors, wrap them in named object types:
  • This gives each item a distinct _type property that Sanity can use to distinguish between them.

Was this page helpful?