How To Solve ‘File Could Not Be Imported’ in Caldera Forms

Caldera Forms is a different kind of WordPress form builder. Developed to be responsive, intuitive and meet the needs of the modern WordPress site builder. Caldera Forms is the free WordPress form builder plugin that does more.

Form could not be imported. File type must be JSON

The folks at Caldera explains the reason but without any real info how to fix it. This has caused a lot of issues for people and also made most of us angry at Caldera, because of the lack of assistance, compared to the other free plugins.

I have spent hours looking for a way to fix this and have read different articles and solutions. The good news is, I have found a solution ๐Ÿ˜

The Fix

While doing my research on the problem, I cam across 2 solutions that worked for other Caldera users like me but unfortunately none of them worked for me. I dug deeper and found a simple fix. Read on.

Solution 1

This solution is provided by Bob Reeves

  • Go to this URL: https://jsonlint.com/
  • Open the caldera exported json file with a text editor
  • copy it then paste into jsonlint
  • click on the validate json button
  • Copy the result back into the original json export file
  • Import the file with no further problems.

If this method didn’t work for you don’t despair, Read on ๐Ÿ˜Ž

Solution 2

This solution is provided by Torsten Landsiedel 

First of all, you need to find out which mime type your server is returning for JSON files and then you need to add this mime type to WordPress as an allowed mime type value for JSON files.
Torsten wrote a blog post about how to achieve this (in German)

Don’t panic, I have recreated the steps below in English ๐Ÿ˜Ž


  • Open your text editor and paste the code below
echo 'PHP Version: ' . phpversion() . "<br/><br/>";
echo 'caldera-form-export.json | ' . mime_content_type( 'caldera-form-export.json') . "<br/>";
  • save the file as test.php
  • upload the file and your caldera form export “caldera-form-export.json” to the root folder of your server and open the “test.php” file, this will display the PHP version and what it believes to be the mime type of the json file.
  • add the following code to your child theme’s function.php
 * Support for 'text/html' as the secondary(?) mime type of .json files
add_filter( 'wp_check_filetype_and_ext', 'wpse323750_secondary_mime', 99, 4 );    
function wpse323750_secondary_mime( $check, $file, $filename, $mimes ) {
    if ( empty( $check['ext'] ) && empty( $check['type'] ) ) {
        // Adjust to your needs!
        $secondary_mime = [ 'json' => 'text/html' ];
        // Run another check, but only for our secondary mime and not on core mime types.
        remove_filter( 'wp_check_filetype_and_ext', 'wpse323750_secondary_mime', 99, 4 );
        $check = wp_check_filetype_and_ext( $file, $filename, $secondary_mime );
        add_filter( 'wp_check_filetype_and_ext', 'wpse323750_secondary_mime', 99, 4 );
    return $check;

That’s all ๐Ÿ˜

Solution 3

This Solution is provided by ๐Ÿ˜

If for some unknown reason NONE of the solutions worked for you, Read on.

Adding support for the mime using code does not always work for some people and so I found a plugin that lets you add any mime support to WordPress.

  • Download plugin is WP Add Mime Types by Kimiya Kitani
  • After installing and activating the plugin, just go to Settings -> Mime Type Settings
  • add “json = text/plain” or any mime you detected in step 3 of solution 2 above
  • Hit save and you are Good ๐Ÿ‘๐Ÿพ๐Ÿ‘๐Ÿพ

If you face any issues feel free to comment below.

Similar Posts

One Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.