Serializer
Using a custom serializer with DrupalClient.
The DrupalClient
uses jsona as the default serializer for serializing and deserializing JSON:API data.
You can provide your own using the serializer
option.
Example
Here's how you can replace the default serializer with jsonapi-serializer.
lib/drupal.ts
import { DrupalClient } from "next-drupal"import { Deserializer } from "jsonapi-serializer"
// Create a custom serializer.const customSerializer = new Deserializer({ keyForAttribute: "camelCase",})
// Pass the custom serializer to the client.export const drupal = new DrupalClient( process.env.NEXT_PUBLIC_DRUPAL_BASE_URL, { serializer: customSerializer, })