Create WordPress posts from JSON array using plugin in admin

Here I assume your json is an array of object where properties are named like wp_insert_post arguments: ‘post_title’, ‘post_content’ and so on.

function process_ajax() {  
    if ( ! isset($_POST['nonce']) || ! wp_verify_nonce($_POST['nonce'], 'mynonce') )
       die('error on checking nonce');  
    if ( ! isset($_POST['filepath']) die('no file given');
    if ( ! file_exists($_POST['filepath']) ) die('invalid file given');
    $posts = json_decode( file_get_contents($_POST['filepath']) );
    $done = 0;
    if ($posts) { 
      foreach ( $posts as $post) {
        $post = (array)$post;
        if ( isset($post['ID']) ) unset($post['ID']);
        if ( wp_insert_post($post) ) $done++;
      } 
      $str = "Successfully insert " . $done . "posts, ";
      $str .=  ( count($posts) - $done ) . ' failed.'
      die($str);
    } else {
      die('File contains not valid Json.');
    }
  }