Our Biggest Sale Is Here
Up to 70% Off
Get the Deal

How to create a table from a JSON file in wpDataTables

Say your HR system can export the employee list as JSON, or a web service returns it from a URL, and you want to show it on your intranet as a table people can search. wpDataTables reads JSON from any URL it can reach and turns every object into a row. Give the URL to Tabella AI, or create a linked table yourself.

What JSON structure can wpDataTables read?

wpDataTables reads a flat JSON array of objects, where every object is a row and every field is a cell. Your data source needs to meet three rules:

  1. It has data. The array is not empty.
  2. It has one structure. It is an array of objects with the same set of fields, like the sample below.
  3. It is reachable. wpDataTables can open the URL from your server, without a login.
[
  {
    "Name": "Ivor Chen",
    "Gender": "Female",
    "Marital Status": "Single",
    "Department": "Accounting"
  },
  {
    "Name": "David Gordon",
    "Gender": "Female",
    "Marital Status": "Married",
    "Department": "Tech Support"
  }
]

This is the start of the sample file employees.json, with 100 made-up employees. Use its URL to follow the steps below.

If the rows sit deeper in the response, for example under results, or the API needs a login or custom headers, use the Nested JSON source type instead.

How do I create a table from a JSON file with Tabella AI?

Paste the JSON URL in the Tabella AI chat, check the preview, and create a linked table.

  1. Open Tabella AI. Go to wpDataTables → Dashboard and click + Use a file or link.
  2. Add the URL. In the Add data panel, paste the URL in Public data URL, or click Media Library to pick an uploaded .json file. Click Preview this source.
  3. Create the table. Check the sample of up to 20 rows, then click Create linked table to keep reading the URL. JSON sources have no Import to database button. The review card says Database import is unavailable for this source or edition. You can still create a linked table.
  4. Add it to a page. Click Copy shortcode and paste it into a Shortcode block.

Apart from the missing import option, the review card looks like the one for CSV files; see how to create a table from a CSV file for a screenshot.

Video: creating a table from a JSON URL with Tabella AI.

How do I create a table from a JSON file by hand?

Create a table linked to an existing data source, choose JSON file as the source type, paste the URL and click Save Changes.

  1. Start a linked table. Go to wpDataTables → Create a Table and click Create a data table linked to an existing data source.
  2. Name the table. Click New wpDataTable and type a name, for example Employees.
  3. Choose the source type. In the Data source tab, open Input data source type and choose JSON file.
  4. Paste the URL. Paste the URL of the JSON data in Input file path or URL.
  5. Save the table. Click Save Changes. wpDataTables reads the data, creates a column for each field and shows the table preview.
New linked table Employees with JSON file as the input data source type and the URL of the employees JSON sample
Linking a table to JSON data: (1) Input data source type, (2) Input file path or URL, (3) Save Changes.
  • Don’t rename, reorder, add or delete fields in the source after you create the table. The table stops working, and you have to create it again.
  • The table reads the URL on every page load. For large or slow sources, turn on caching.
  • You can’t edit the rows of a linked table in WordPress.

How do I set up the JSON table after it is created?

Open the table in the editor and change the table and column settings, the same way as for any other table. For example, click the column settings icon of the Gender column, open the Filtering tab, keep Allow filtering on and set Filter type to Selectbox, so visitors pick a value from a list.

Column settings of the Gender column in wpDataTables with the Filtering tab, Allow filtering and the filter type Selectbox
Column settings of the Gender column: (1) the column name, (2) the Filtering tab, (3) Filter type.

The filter types are Text, Number, Number range, Date range, DateTime range, Time range, Selectbox, Multiselectbox and Checkbox. Read how to add filters for what each one does.

Read how to configure a table in the table editor for every setting.

What should I remember about tables from JSON?

wpDataTables reads a non-empty array of objects with the same fields from a URL it can reach. Paste the URL in Tabella AI, or create a linked table with JSON file as the source type. Keep the fields unchanged after you create the table, and use Nested JSON for rows below the top level or for APIs that need a login.

Wait, Before You Download!

To get your hands on wpDataTables Lite, please enter your email address below. We’ll send you a direct download link and keep you updated on existing features along with helpful tips and tricks!

By continuing, I accept Privacy Policy and T&C
Mail Box