deserialize
A helper for deserializing JSON:API resources.
const resource = drupal.deserialize(body, options?)
body
- Required
- The raw JSON:API response.
options
- Optional
- Options for the deserializer.
Notes
- To provide your own custom deserializer, see the deserializer docs.
Examples
const url = drupal.buildUrl("/jsonapi/node/article", { sort: "-created", "fields[node--article]": "title,path",})
const response = await drupal.fetch(url.toString())
const json = await response.json()
const resource = drupal.deserialize(json)