Feeds extensible parsers

You are browsing documentation for an older version of Drupal, which is not supported any longer, and the information may not be correct. See current documentation for Contributed modules

Overview

The feeds extensible parsers module is a set of extensible parsers for Feeds.

Required modules

Provided parsers

XPath XML & HTML

For now, use the documentation for Feeds XPath parser

QueryPath XML & HTML

Requires the QueryPath module.
See the QueryPath CSS Selector Reference.

JSONPath JSON & JSON lines

To use the JSONPath parser, install the Feeds Extensible Parser module, then place the file 'jsonpath-0.8.1.php' into sites/all/libraries/jsonpath and clear the cache. When selecting a parser for a new Feed importer, the jsonPath Parser should now appear as an option

See the JSONPath expression tester.
Note: The JMESPath parser is preferred if you can meet the requirements.
See the JSONPath documenation.

JMESPath JSON & JSON lines

To use the JMESPath parsers, you'll need Composer, and PHP >= 5.4.

In sites/all/libraries:

$ git clone https://github.com/mtdowling/jmespath.php.git
$ cd jmespath.php
$ composer install
$ drush cc all # Or just clear the cache however you normally would.

See the documentation for the selector syntax.
See http://jmespath.org for an expression tester.
See #2494185: JMESPath parser requirement for "Context" makes value inaccessible? for a practical example of how to configure the Context.

JSONPath Example

(source: https://www.drupal.org/project/feeds_jsonpath_parser)
Starting with the JSON document:

{ "store": {
    "book": [
      { "category": "reference",
        "author": "Nigel Rees",
        "title": "Sayings of the Century",
        "price": 8.95
      },
      { "category": "fiction",
        "author": "Evelyn Waugh",
        "title": "Sword of Honour",
        "price": 12.99
      },
      { "category": "fiction",
        "author": "Herman Melville",
        "title": "Moby Dick",
        "isbn": "0-553-21311-3",
        "price": 8.99
      },
      { "category": "fiction",
        "author": "J. R. R. Tolkien",
        "title": "The Lord of the Rings",
        "isbn": "0-395-19395-8",
        "price": 22.99
      }
    ],
    "bicycle": {
      "color": "red",
      "price": 19.95
    }
  }
}

Assuming you have JSONPath expressions mapped to the Title, and Author fields, your expressions would look like:

Context: $.store.book.*
    Title: title
    Author: author

Creating a reusable XML parser feature.

@todo

Example of a Flickr feed

A Flickr JSON parser for the Feeds extensible parsers module.

Guide maintainers

twistor's picture