Unlock seamless workflows and faster delivery with our latest releases - Join the deep dive

Converting JSON to a readable URL for audio assets

3 replies
Last updated: Jun 10, 2023
hi! how can i convert this json to a readable url on the client that links to the asset.
"audio": {
    "_type": "file",
    "asset": {
      "_ref": "file-595808d57da3d3513d1410f284c538c435bca8a3-wav",
      "_type": "reference"
    }
  },
I've used
imageUrlBuilder
for images but not sure how to achieve this with audio (file type). is there another plug-in?Thanks
Jun 10, 2023, 8:39 PM
Hi
user C
. You can dereference the asset in your GROQ query to return all of the properties.

audio{
  ...,
  asset->
}
Jun 10, 2023, 8:57 PM
thanks will read more on this
Jun 10, 2023, 9:12 PM
Works! šŸ™
Jun 10, 2023, 9:23 PM

Sanityā€“ build remarkable experiences at scale

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

Was this answer helpful?