Features

This is a parser for the Feeds module that allows parsing JSON using JSONPath. It is very similar to the Feeds XPath Parser module.

Installation

The file jsonpath-0.8.1.php must be downloaded and put in the module folder. After installing the module, clear your cache so that the parser will be available in Feeds.

Documentation

Documentation can be found at http://goessner.net/articles/JsonPath/, and http://code.google.com/p/jsonpath/wiki/PHP.
** The syntax is different for the @ operator. In the documentation, examples look like @.name. That syntax changes to @['name'] since this is PHP and not Javascript.

Example

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

Project Information

Downloads