Wordpress Migration JSON Not Working

Following the Wordpress Migration Guide, I installed the plugin and exported my Wordpress posts, then cleaned them up so that everything is valid JSON.

However, when trying to get that file into Ghost, I’m getting the error: Import failed
Expected “,” or “}” but “[” found.

The format hasn’t changed from the export, which is (example for structure):

{
	"data": {
		"posts": [{
			"id": 1,
			"title": "",
			"slug": "",
			"markdown": "",
			"html": "",
			"image": "",
			"featured": 0,
			"page": 0,
			"status": "published",
			"language": "en_US",
			"meta_title": null,
			"meta_description": null,
			"author_id": 26,
			"created_at": "Thu, 12 Jan 2017 17:35:37 +0000",
			"created_by": 1,
			"updated_at": "Tue, 20 Feb 2018 16:41:58 +0000",
			"updated_by": 1,
			"published_at": "Thu, 12 Jan 2017 17:35:37 +0000",
			"published_by": 1
		}],
	"users": [{
		"id": 9,
		"slug": "",
		"bio": false,
		"website": "",
		"created_at": "Thu, 13 Nov 2014 04:16:52 +0000",
		"created_by": 1,
		"email": "",
		"name": "" 
	}]
}

}

I’m not sure what the issue is at this point.

Figured this out… seems as if the exporter plugin doesn’t export in the right format. Figured this out by exporting from Ghost to see what the format is.

The structure needs the database object at the top:

{
“db”: [{
“meta”: {
“exported_on”: 1531754559484,
“version”: “1.22.1”
},
“data”: {
“posts”: [
{
“id”: 7131,
“title”: “”,
“slug”: “”,
“markdown”: “”,
“html”: “”,
“image”: “”,
“featured”: 0,
“page”: 0,
“status”: “published”,
“language”: “en_US”,
“meta_title”: null,
“meta_description”: null,
“author_id”: 41,
“created_at”: “Mon, 25 Jun 2018 13:44:29 +0000”,
“created_by”: 1,
“updated_at”: “Wed, 27 Jun 2018 13:59:01 +0000”,
“updated_by”: 1,
“published_at”: “Mon, 25 Jun 2018 13:44:29 +0000”,
“published_by”: 1
}
],
“users”: [
{
“id”: 27,
“slug”: “”,
“bio”: false,
“website”: “”,
“created_at”: “Thu, 19 Jan 2017 18:41:55 +0000”,
“created_by”: 1,
“email”: “”,
“name”: “”
}
]
}
}]
}

Think the Ghost team needs to update that WP plugin.

Ghost is open source. If you figured out what the issue is, then you are the Ghost team.

If you’ve already gone to all the trouble of debugging this and determining how to resolve it, then why not contribute back to the project you’re benefitting from by opening a pull request? That way, other people who run into the same issue as you in future will have a better time, rather than having to go through all the same steps you did.

That’s how open source works. Other people make stuff for you, you use it, you make it better, other people use it, they make it better, everyone wins.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.