Using Text (Formatted) Field, if the field contains a value, a get request with jsonapi returns a malformed json (missing the closing "}")

Created on 30 October 2024, about 2 months ago

Problem/Motivation

JSON API GET requests to a node with a Text (Formatted) Field that contains a value returns malformed (missing the closing "}")

If the field does not contain a value the json is correct.

Steps to reproduce

I will preface that this site is set up as a drupal multisite not sure if that matters

1) create a content type with a text (formatted field)

2) create a test page using this content type

3) get request with json api to this specific node returns correctly, the text formatted field value is null

4) add some data to the text formatted field

5) get request with json api to this specific node returns malformed, the text formatted field value is correctly structured as a json object { value: "...", processed: "...", format: "full_html"}, but for some reason the request
is missing a "}" at the end, resulting in the malform.

Not sure what is causing this , this happens working locally with ddev and on our staging site, ive disabled patches, couple modules to rule them out nothing worked.

Proposed resolution

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

🐛 Bug report
Status

Active

Version

10.4

Component

jsonapi.module

Created by

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

Comments & Activities

  • Issue created by @gukki
  • Can we see the an example of the complete HTTP response? Wrap code output in <code>, which is needed here to render formatted output properly.

    I can't reproduce this on a new Drupal install with https://simplytest.me. The output is well-formed.

    Add to the issue summary complete steps to reproduce that you verified beginning with installing Drupal 10.

  • Thank you @cilefen for looking into this and showing me this website to help with debugging. I was able to narrow down the issue being caused by my custom theme, which later I was able to narrow down the problem being a blank line in my .theme file which i thought was empty. As soon as I removed the blank line everything works.

Production build 0.71.5 2024