---
title: "Store custom data in PDF annotations using JavaScript | Nutrient"
canonical_url: "https://www.nutrient.io/guides/web/annotations/custom-data-in-annotations/"
md_url: "https://www.nutrient.io/guides/web/annotations/custom-data-in-annotations.md"
last_updated: "2026-05-23T00:08:18.167Z"
description: "Discover how to effectively use custom data in annotations. Enhance your projects with our step-by-step guide to creating tailored annotation solutions."
---

# Store custom data in annotations

When adding an annotation to a document, Nutrient allows storing of additional data that you can specify for each annotation. This data is persistently stored along with the annotation if the annotation is stored in one of the following formats:

1. Embedded in the PDF

2. [Instant JSON](https://www.nutrient.io/guides/web/importing-exporting/instant-json.md)

3. [XFDF](https://www.nutrient.io/guides/web/importing-exporting/xfdf-support.md)

Nutrient automatically handles the serialization of the custom data attached to an annotation for these formats.

## Storing custom data

[Nutrient Web SDK 2019.2](https://www.nutrient.io/blog/pspdfkit-web-2019-2/) added the [`customData` property to `NutrientViewer.Annotations.Annotation`](https://www.nutrient.io/api/web/NutrientViewer.Annotations.Annotation.html#customData). This property allows you to store an arbitrary JSON-compliant dictionary in an annotation, like so:

### JAVASCRIPT

```javascript

const updatedAnnotation = annotation.set("customData", {
  name: "Grill House",
  locations: ["Vienna", "Paris", "New York"],
  rating: 5,
  verified: true
});

instance.update(updatedAnnotation);

```
---

## Related pages

- [Annotation customization](/guides/web/annotations/custom-rendered-annotations.md)
- [Annotation appearance streams](/guides/web/annotations/appearance-streams.md)
- [Annotation notes](/guides/web/annotations/customization/annotation-notes.md)
- [Customizing display logic for annotations](/guides/web/best-practices/business-logic.md)
- [Configuring annotation presets in our viewer](/guides/web/customizing-the-interface/using-annotation-presets.md)
- [Hiding annotations in our viewer](/guides/web/annotations/customization/hiding-annotations.md)

