deserialize
A helper for deserializing JSON:API resources.
const resource = drupal.deserialize(body, options?)
body: JsonApiResponse
- Required
- The raw JSON:API response.
body
- Optional
- Options for the deserializer.
Notes
- To provide your own custom deserializer, see the serializer 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)