Problem/Motivation

It's not easy to guess how to structure the Json file. I have try to run the import but it's keep to failed silently. I think it's something with my Json not being formatted properly.

Processed 0 items (0 created, 0 updated, 0 failed, 0 ignored) - done with 'test'

Proposed resolution

Document the json structure in the readme file.

Comments

targoo created an issue. See original summary.

raj45’s picture

I agree, it would be great with a working example, like the one @heddn posted for Migrate Source CSV here: https://www.drupal.org/node/2570815#comment-10545764

raj45’s picture

raj45’s picture

Title: Json example » Include JSON example in the module
Category: Support request » Task
geerlingguy’s picture

Do we need to include an example in the module, or could we just point to one in documentation (either on the project page or in a dedicated docs page)?

geerlingguy’s picture

I've also written a quick (very simple) tutorial for basic use cases: Migrate a custom JSON feed in Drupal 8 with Migrate Source JSON.

targoo’s picture

+1 on the tutorial

ressa’s picture

The JSON migrate example at https://github.com/heddn/d8_json_migrate still works fine, using these modules:

  • Drupal core 8.1.1
  • Migrate Plus (migrate_plus) 8.x-2.0-beta1+1-dev
  • Migrate Source JSON (migrate_source_json) 8.x-2.x-dev
  • Migrate Tools (migrate_tools) 8.x-2.0-beta1+0-dev

However, if I try to uninstall the module with drush pmu d8_json_migrate -y, I get this error:

Drush command terminated abnormally due to an unrecoverable error.
Error: Class 'Drupal\migrate\Entity\Migration' not found in /var/www/site/docroot/d8-json/modules/d8_json_migrate/d8_json_migrate.install, line 12
mchelen’s picture

@geerlingguy IMHO linking to an example or tutorial from the project page would be fine for now, but I'd love to see the example included with the codebase for sake of consolidation & unified versioning.

ressa’s picture

I agree with @Mike Chelen: to get an example included in the code base would ensure it gets updated and stays current. I recommend we use the example at https://github.com/heddn/d8_json_migrate - since it is a fully working example, except for the un-install, but that's a minor issue.

mchelen’s picture

I've also made an incredibly simple example here: https://github.com/mchelen/migrate_acme/tree/json

mikeryan’s picture

Status: Active » Closed (won't fix)

This module has been superseded by the json parser plugin in migrate_plus and is no longer supported. There is a JSON example in the migrate_example module included with migrate_plus.

ressa’s picture

Thank you @mikeryan!

EDIT: For Drupal 8.6, see also Migrate JSON Example.