diff --git a/src/Lodash/Http/Resources/JsonResource.php b/src/Lodash/Http/Resources/JsonResource.php index a5e6a3b..9751926 100644 --- a/src/Lodash/Http/Resources/JsonResource.php +++ b/src/Lodash/Http/Resources/JsonResource.php @@ -19,6 +19,9 @@ use function method_exists; use function ucfirst; +use const JSON_UNESCAPED_SLASHES; +use const JSON_UNESCAPED_UNICODE; + abstract class JsonResource extends BaseResource { use TransformsData; @@ -185,4 +188,9 @@ private static function undot(array $array): array return $result; } + + public function jsonOptions(): int + { + return JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE; + } } diff --git a/src/Lodash/Http/Resources/JsonResourceCollection.php b/src/Lodash/Http/Resources/JsonResourceCollection.php index 98f4ec1..0535c49 100644 --- a/src/Lodash/Http/Resources/JsonResourceCollection.php +++ b/src/Lodash/Http/Resources/JsonResourceCollection.php @@ -10,6 +10,9 @@ use function array_merge_recursive; use function is_null; +use const JSON_UNESCAPED_SLASHES; +use const JSON_UNESCAPED_UNICODE; + class JsonResourceCollection extends BaseResourceCollection { public function toArray($request): array @@ -49,4 +52,9 @@ protected function preparePaginatedResponse($request) return (new PaginatedResourceResponse($this))->toResponse($request); } + + public function jsonOptions(): int + { + return JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE; + } }