Upgrade Your Drupal Skills

We trained 1,000+ Drupal Developers over the last decade.

See Advanced Courses NAH, I know Enough

How to send the JSON data from a Drupal 8 site?

Parent Feed: 

How to get Drupal 8 site data to a mobile app

Imagine a situation: your mobile application needs to get some information from your site on Drupal 8 using JSON. How to do it without much effort and installing additional modules, how to change the JSON array programmatically, and send the JSON data with and without using Views - all of these you will learn from this article.

Several ways to create and send data in the JSON format in Drupal 8

Good news! You do not need to write code or download additional modules to configure the sending of a JSON data using REST and to customize a JSON array. Everything you need is already in the core of Drupal 8. First of all, you need to install the Views and Rest modules and determine an exported content type. If you have never worked and are not familiar with the Rest module, I recommend that you familiarize yourself with this guide before reading the rest of the article.

Send the JSON data with REST and Views

Step 1

Create a new view. At this step, you just select a name, content type, click “REST EXPORT SETTINGS”, and set a path via which you will later get the data in the JSON format.

Original Post: 

About Drupal Sun

Drupal Sun is an Evolving Web project. It allows you to:

  • Do full-text search on all the articles in Drupal Planet (thanks to Apache Solr)
  • Facet based on tags, author, or feed
  • Flip through articles quickly (with j/k or arrow keys) to find what you're interested in
  • View the entire article text inline, or in the context of the site where it was created

See the blog post at Evolving Web

Evolving Web