👀 See Sanity in action: Watch product demo now →

Portable Text Field with a Bullet List - How should this look in JSON?

4 replies
Last updated: Dec 1, 2020
I have a portable text field with a bullet list. Should the json for this field be one list object with all the list items as children? Or will each list items be separate objects? Because the latter behaviour is what I'm currently getting, but it seems incorrect, since it's a bit difficult the parse out the list as one cohesive list of items.
Nov 24, 2020, 3:52 PM
I'm still wondering if this is a bug, or if this is expected behavior. Any who knows? If list items should be nested under a parent list object, when querying portable text?
Dec 1, 2020, 12:18 PM
This is the current and correct behavior as of now. The
level
 property is controlling the… level. But you're right, it makes it not obvious in terms of serialization, so we're considering if we need to change it when we take the spec to 1.0.
Dec 1, 2020, 12:42 PM
Thanks for the reply! Great to know its the correct behavior, so my parsing won't suddenly break. 🙂
Dec 1, 2020, 2:15 PM

Sanity.io – build remarkable experiences at scale

Sanity is a customizable solution that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Categorized in