---
title: "How to Import JSON Data into WordPress Posts (with Nested Fields)"
url: "https://wpimportexport.com/import-json-into-wordpress-posts/"
description: "Import a JSON file into WordPress posts with authors, dates, categories, tags and featured images, including nested values such as author.name and image.url."
type: post
published: 2026-11-13T13:00:00+00:00
modified: 2026-11-14T10:44:23+00:00
categories: ["Import Guides", "Tutorials"]
tags: ["CSV import", "Import Export by RockStarLab"]
docs_topics: ["Import guides"]
---

# How to Import JSON Data into WordPress Posts (with Nested Fields)

Recipes from a headless CMS, articles from an old site’s API, entries from a no-code tool: a lot of content leaves its home as JSON. [Import Export by RockStarLab](https://wordpress.org/plugins/import-export-by-rockstarlab/) imports a JSON file into WordPress posts, including nested values such as an author object or an image object, with authors, categories, tags, dates and featured images. The example has three recipes for a coffee roastery’s blog.

**Free:** JSON import into posts and pages is in the free plugin. **PRO:** custom post types, users and WooCommerce products.

## Short Answer

1. Make sure the file is an array of objects: `[ { … }, { … } ]`. If your API wraps it (`{"recipes": [ … ]}`), save the inner array.
2. Go to **Import Export by RockStarLab → Import**, choose **Posts** and upload the .json file.
3. Click **Auto Map**. Nested values appear as their own columns, such as `author.name` and `image.url`.
4. Keep the source’s own `id` in a custom field instead of the WordPress ID, then run the import.

## The file

Each recipe has flat fields, a list of tags, and two objects, the author and the image:

```
[
  {
    "id": 501,
    "slug": "iced-oat-latte",
    "name": "Iced Oat Latte",
    "summary": "A double shot over ice with oat milk.",
    "body": "<p>Pull a double shot, pour over ice and top with 150 ml oat milk.</p>",
    "published": "2026-05-02 08:00:00",
    "category": "Recipes",
    "tags": ["iced", "oat milk"],
    "author": { "name": "Lena Novak", "email": "lena@example-roastery.com" },
    "image": { "url": "https://old.example-roastery.com/…/iced-oat-latte.jpg", "alt": "Iced oat latte in a tall glass" }
  },
  …
]
```

APIs often wrap the list with paging information, like `{"count": 3, "recipes": [ … ]}`. The importer reads a top-level array of objects (or an object whose members are objects), so save just the `recipes` array as the file. With the jq tool that’s `jq '.recipes' response.json > recipes.json`; most code editors can do the same.

## Map the columns

The values inside `author` and `image` appear as their own columns, named by their path. **Auto Map** placed most of them:

![Mapped Fields for a JSON import: name to post_title, body to post_content, published to post_date, category and tags to taxonomies, author.name and author.email to the author fields, image.url and image.alt to the featured image, slug to post_name, id to meta_source_id, summary to post_excerpt](https://wpimportexport.com/wp-content/uploads/2026/11/01-mapped-fields-6.webp)

_Nested values like author.name and image.url map like any other column._

- `author.name` and `author.email` go to the author fields, which find the user by email or create an author account.
- `image.url` and `image.alt` become the featured image and its alt text.
- `published` holds a date, so it went to Date. `tags` is a list and imports as several tags.
- We dragged `summary` to Excerpt ourselves.

Auto Map also matched `id` to the WordPress **ID**. For content from another system, remove that mapping: the source’s 501 has nothing to do with post 501 on your site. We added a custom field `source_id` with **+ Add** in the Custom Fields group and mapped `id` there. It’s useful later for updates: export the posts with that field, or match on it.

## The result

![Import Completed Successfully: 3 successful, 3 created, 0 failed, duration 2s](https://wpimportexport.com/wp-content/uploads/2026/11/02-import-result.webp)

_Three recipes created from the JSON file._

All three recipes were created in 2 seconds:

- Publish dates from `published` (2 May, 10 June and 1 July 2026).
- Authors: Lena Novak and Tomás Rivera, found or created from their name and email.
- Category Recipes, and tags “iced”, “oat milk”, “summer” and “cold brew” from the lists.
- The image downloaded to the Media Library as the featured image of the Iced Oat Latte, with its alt text.
- `source_id` 501, 502 and 503 on the posts.

The HTML in `body` went into the content as it was. For more on HTML content, see [importing HTML without breaking formatting](https://wpimportexport.com/import-html-content-wordpress/).

## Before you import

A JSON import can create users, terms and media as well as posts. [Back up the site](https://wpimportexport.com/how-to-create-a-wordpress-website-backup-and-restore-it/) and try a file with two or three records first.

## With an AI agent

An AI agent connected through the WordPress MCP Adapter (see [connecting Claude Code to WordPress](https://wpimportexport.com/connect-claude-code-to-wordpress-mcp/)) can check the imported recipes:

```
List the posts in Recipes with their date, author, source ID and tags.
```

In our run, the agent called `rsl-ie/export-preview` with those fields for the Recipes category. It returned the three recipes with the dates from the file, Lena Novak and Tomás Rivera as authors, source IDs 501 to 503 and their tags.

## FAQ

### What JSON structure can I import?

An array of objects, or an object whose members are objects. Save a wrapped API response’s inner array as the file.

### How are nested objects handled?

Each value inside an object gets its own column named by its path, like author.name or image.url. The original column stays too.

### How do lists import?

A list such as tags stays one column. Mapped to a taxonomy, each item becomes a term.

### Can I import from a JSON URL?

Yes. Import from a URL, or schedule it to repeat; see the scheduled import guide.

### Should I map the source id to the WordPress ID?

No, for content from another system. Keep it in a custom field so you can match records later.

## Related Guides

- [Nested JSON Imports and Smarter Auto Map (What’s New in 2.1.41)](https://wpimportexport.com/nested-json-import-import-export-by-rockstarlab-2-1-41/)
- [CSV, JSON, XML, XLSX and ODS: What Data Formats Are and When to Use Them](https://wpimportexport.com/csv-json-xml-xlsx-and-ods-what-data-formats-are-and-when-to-use-them/)
- [How to Assign Post Authors When Importing WordPress Posts from CSV](https://wpimportexport.com/import-wordpress-posts-assign-author-csv/)
- [Automatic WordPress Import from a URL on a Schedule](https://wpimportexport.com/wordpress-scheduled-import-from-url/)

Get the free plugin on [WordPress.org](https://wordpress.org/plugins/import-export-by-rockstarlab/).
