Serialization module: (de)serializing data to/from JSON & more

The Serialization module is included in Drupal 8 core.

It is built on top of the Symfony Serializer component.

The Serialization module provides a framework to add additional serialization formats simply by installing additional modules. Drupal 8 core's HAL module adds support for HAL+JSON, the CSV serialization contrib module adds CSV support.

JavaScript and Drupal 8 RESTful Web Services

This page aims to outline how to use JavaScript to communicate with Drupal 8's RESTful services. It is broken into sections per entity type.

It outlines:

  1. which HTTP method to use (GET, POST, PATCH, or DELETE) on which URL
  2. which headers to send
  3. what response can be expected from the server

For the following entity types:

HAL module: serialization using the Hypertext Application Language

The HAL module is included in Drupal core. When enabled, the HAL module serializes entities using HAL (Hypertext Application Language).

What is it?

For general information about the language, see the informal or formal (06) HAL specification.

Feeds JSONPath Parser

1) Identify the json URL, and look at it using this tool: http://jsonviewer.stack.hu/ (or, if you know the json well, identify what you want to import.

2) Download jsonpath php file here: http://jsonpath.googlecode.com/files/jsonpath-0.8.1.php and place inside sites/all/modules/feeds_jsonpath_parser

3) Create a new parser using feeds, with the jsonpath parser selected

4) Example json:


{
  "tumblelog": {
    "title": "Tumblr Blog",
    ..... (other global fields)
  },
  "posts": [
    {
      "id": "46252144726",
      "url": "http://whatever.com",
      "type": "regular",
      "date": "Mon, 25 Mar 2013 10:45:38",
      "regular-title": "Test Blog Entry",
      "regular-body": "Body text goes here",
      "tags": [
        "tag1",
        "tag2",
      ]
    },
   {
      "id": 46249331035,
.... rest of posts

OK, so now is where I'm getting unclear, and need help.

5) In the jsonpath parser settings page:admin/structure/feeds/rss_feed_importer/settings/FeedsJSONPathParser there are two elements, "Context" and "Title". In the Context field, if you want to map the variables in post, to fields in a blog content type, for example, you need to let jsonpath parser know where to start. So in this case, the context would be:

$.tumblelog.posts.*

Serialization API

The Serialization API is new in Drupal 8. It is largely based on the Symfony Serializer component, so their documentation is also relevant.

For high-level information on what this module does, see the Serialization module documentation.

 Symfony documentation.

API features

Ordered by most to least frequently used APIs:

Pages

Subscribe with RSS Subscribe to RSS - json