JSON string is escaped when access via REST

Created on 6 April 2021, about 4 years ago
Updated 20 January 2023, about 2 years ago

Problem/Motivation

If you have a JSON field on an entity that is accessed via REST, the JSON string is treated like any other string and escaped. This leads to weird outcomes if you have a < symbol inside your JSON, Drupal will truncate everything after the <.

Steps to reproduce

  1. Create a json_field on a entity
  2. Create an entity with a json_field value that a < within it.
  3. Access via cores EntityResource endpoints, e.g. /entity/node/article

Proposed resolution

Provide a custom normalizer.

Remaining tasks

Tests

🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

🇦🇺Australia benjy

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

No activities found.

Production build 0.71.5 2024