I'm currently really busy to get the migration work on my desk. I want to import (migrate) a local json file into drupal8 using Migrate_Plus, Migrate tools. For that I have the following migration yml configuration file

# Migration configuration for products.
id: product
label: 'Product'
migration_group: Products
# Here we define the migration source
  plugin: url
  data_fetcher_plugin: file
  data_parser_plugin: json
  urls: /modules/custom/migrate_products/data/data.json
  item_selector: /data
      name: uuid
      label: 'uuid'
      selector: uuid/value

     name: name
     label: 'Produkt Name'
     selector: name/value

      name: supplierName
      label: 'Anbietername'
      selector: supplierName/value

     type: string

    plugin: entity:node

    plugin: default_value
    default_value: produkt

  title: name
  field_uuid: uuid
  field_suppliername: supplierName

    plugin: default_value
    default_value: 0
    plugin: default_value
    default_value: 0

  required: {}
  optional: {}

      - migrate_products

Like you can see, the json file is located inside the custom module directory.

The json file looks like this:

  "data": [
      "uuid": {
        "value": "7d51-4406-a7ef-3a7916b977a9",
        "patient": false
      "name": {
        "value": "Product1",
        "patient": false
      "supplierName": {
        "value": "User1",
        "patient": false

After enbaling the required migration module, when running: drush ms I get the following output:

file parser plugin: could not retrieve data from /modules/custom/migrate_products/data/data.json
 Group: Products (Products)  Status  Total  Imported  Unprocessed  Last imported 
 product                     Idle    n. v.  0         n. v.

1 Answer 1


The data fetcher plugin can't find your JSON file because the format is wrong. The plugin is expecting Drupal's URI format (e.g. public://path/to/data.json or private://path/to/data.json) under its private/public file dir. For example, see the included example migration with the module:

  # The data_parser normally limits the fields passed on to the source plugin
  # to fields configured to be used as part of the migration. To support more
  # dynamic migrations, the JSON data parser supports including the original
  # data for the current row. Simply include the 'include_raw_data' flag set
  # to `true` to enable this. This option is disabled by default to minimize
  # memory footprint for migrations that do not need this capability.
  # include_raw_data: true
  # Flags whether to track changes to incoming data. If TRUE, we will maintain
  # hashed source rows to determine whether incoming data has changed.
  # track_changes: true
  # Copy the example JSON file in artifacts folder to sites/default/files folder.
    - 'public://migrate_json_example/products.json'
  • When I try this, I get an error: Migration failed with source plugin exception: Error message: cURL error 1: Protocol "public" not supported or disabled in libcurl (see http://curl.haxx.se/libcurl/c/libcurl-errors.html) at public://articles/images/images.json. - any idea what could be the cause?
    – MrUpsidown
    Oct 3, 2019 at 12:20
  • It looks like public://URI isn't getting translated to the HTTP protocol before it is passed off to cURL for retrieval.
    – Shawn Conn
    Oct 10, 2019 at 17:44
  • I am on Docker and what I wanted to achieve ultimately was to retrieve the JSON from a local route which wasn't working either. In the end I found out I had to declare the path as nginx_back/api/article/images.json where nginx_back is the name of my NGINX container. That works with the data_fetcher_plugin set to http. Worth noting...
    – MrUpsidown
    Oct 10, 2019 at 19:15

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.