Import from JSON fails - slug validation

I am trying to import some posts to my Ghost installation using JSON per the Developer Migration Docs.

However, when I try import the valid JSON (complete file here) it fails with the error:
Value in [posts.slug] exceeds maximum length of 191 characters.

My posts do not have slugs at all. According to the docs, the slug is optional and will be generated by Ghost if missing. Here’s an example of a post.

        "posts": [
                "id": 5,
                "status": "published",
                "published_by": 2,
                "url": "",
                "title": "S v Makwanyane and Another (CCT3/94) [1995] ZACC 3; 1995 (6) BCLR 665; 1995 (3) SA 391; [1996] 2 CHRLD 164; 1995 (2) SACR 1 (6 June 1995)",
                "dateString": "1995-06-06T04:00:00.000Z",
                "published_at": 802411200000

I’m going to take a guess. It’s a ‘drinking morning tea while reading the forum’ guess, not a ‘I read all the code and found the problem’ guess. So I’m speculating. You’ve been warned. :)

Philosophically, Ghost generates slugs from titles. The documentation says that Ghost will generate a slug for you. What if that’s what’s happening here? Your have some IMPRESSIVELY long titles. I suspect Ghost tries to use your title to make a slug, and the slug then exceeds the length limit, so it throws an error.

Can you get whatever program is writing the json to write a slug in the json output? A reasonable-length one? If my hypothesis is correct, that should cause this import to work.


Thanks @Cathy_Sarisky! That did the trick. I generated new slugs that were short enough and added them to the post object.

1 Like