I'm using the REST export to expose a list of my nodes including some fields. One of the fields is paragraphs field with subfields.

I have written a formatter for this paragraphs field that puts together some of the fields within the paragraph and renders them as a json object.

The only problem I have is that the serialiser automatically adds quotation marks, which turns my json object into a string and thus renders the formatter futile.

Can I somehow tell the serializer to not do that to my field and just print the json string without doing anything to it? I couldn't find any setting in the view that would help me. Using a "raw output" only prints the paragraph ID.

EDIT: A couple of hours later I stumbled upon this article (https://blog.karmacomputing.co.uk/drupal-8-rest-endpoint-with-entity-reference-field-set-to-unlimited-using-views/) and the REST Views module (https://www.drupal.org/project/rest_views) which basically does what I want to achieve, but unfortunately only renders the entire paragraph content as an array and doesn't allow to change the labels. A boolean field is also printed as a string. It's close to what I need, but not quite it.

  • Should it be a Normalizer and not a field formatter in this case?
    – Kevin
    Commented Jul 19, 2019 at 12:49
  • It doesn't make a difference to me if it is a normaliser or a field formatter, I just need my json export to be able to render paragraphs as arrays properly. At first I thought the field formatter approach would be best, but then I ran into the serialising problem. So I think that I'm going to try writing my own normaliser next.
    – stopopol
    Commented Jul 19, 2019 at 12:52

1 Answer 1


I had to change my overall approach to the problem, but managed to solve the serialising problem by using two additional modules:



The description of the REST Export Nested explains everything. The only thing that might provide problematic is the performance as this involves potentially calling a lot of sub-views. So maybe writing a custom normaliser as indicated in one of the comments is a better approach.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.