---
url: /hooks/filters/wpce-before-document-from-json.md
description: Filter the JSON string before Document::from_json() creates a WPCE document.
---

# `wpce_before_document_from_json`&#x20;

Filters the JSON string when a [`Document`](https://bitbucket.org/ownbit/ownbit-wpce/src/dev/plugin/includes/WPCE/Document.php) is loaded via `Document::from_json`.

## Parameters

1. `string $json`

   The JSON string to load the document from.

## Example

```php
add_filter('wpce_before_document_from_json', function (string $json) {
	// ...

	return $json;
});
```

## Related

* [`wpce_before_document_load`](./wpce-before-document-load)
* [`wpce_before_document_from_post`](./wpce-before-document-from-post)
* [`wpce_before_document_from_rest_request`](./wpce-before-document-from-rest-request)
* [`wpce_before_document_from_save_request_body`](./wpce-before-document-from-save-request-body)
