diff --git entity/entity.controller.inc entity/entity.controller.inc
index 4338274..57ad9ca 100644
--- entity/entity.controller.inc
+++ entity/entity.controller.inc
@@ -45,15 +45,15 @@ interface EntityAPIControllerInterface extends DrupalEntityControllerInterface {
   /**
    * Create a new entity.
    *
-   * @param $values
+   * @param array $values
    *   An array of values to set, keyed by property name.
    * @return
    *   A new instance of the entity type.
    */
-  public function create($values = array());
+  public function create(array $values = array());
 
   /**
-   * Exports an entity.
+   * Exports an entity as serialized string.
    *
    * @param $entity
    *   The entity to export.
@@ -61,10 +61,22 @@ interface EntityAPIControllerInterface extends DrupalEntityControllerInterface {
    *   An optional prefix for each line.
    *
    * @return
-   *   The exported entity as code.
+   *   The exported entity as serialized string. The format is determined by
+   *   the controller and has to be compatible with the format that is accepted
+   *   by the import() method.
    */
   public function export($entity, $prefix = '');
 
+  /**
+   * Imports an entity from a string.
+   *
+   * @param string $export
+   *   An exported entity as serialized string.
+   *
+   * @return
+   *   An entity object not yet saved.
+   */
+  public function import($export);
 
   /**
    * Builds a structured array representing the entity's content.
@@ -438,7 +450,7 @@ class EntityAPIController extends DrupalDefaultEntityController implements Entit
   /**
    * Implements EntityAPIControllerInterface.
    */
-  public function create($values = array()) {
+  public function create(array $values = array()) {
     if (isset($this->entityInfo['entity class']) && $class = $this->entityInfo['entity class']) {
       // Add is_new property if it is not set.
       $values += array('is_new' => TRUE);
@@ -449,6 +461,9 @@ class EntityAPIController extends DrupalDefaultEntityController implements Entit
 
   /**
    * Implements EntityAPIControllerInterface.
+   *
+   * @return
+   *   A serialized string in JSON format suitable for the import() method.
    */
   public function export($entity, $prefix = '') {
     $vars = get_object_vars($entity);
@@ -456,7 +471,21 @@ class EntityAPIController extends DrupalDefaultEntityController implements Entit
     if ($this->nameKey != $this->idKey) {
       unset($vars[$this->idKey]);
     }
-    return "entity_create('$this->entityType', " . entity_var_export($vars, $prefix) . ")";
+    return entity_var_json_export($vars, $prefix);
+  }
+
+  /**
+   * Implements EntityAPIControllerInterface.
+   *
+   * @param $export
+   *   A serialized string in JSON format as produced by the export() method.
+   */
+  public function import($export) {
+    $vars = drupal_json_decode($export);
+    if (is_array($vars)) {
+      return $this->create($vars);
+    }
+    return FALSE;
   }
 
   /**
diff --git entity/entity.features.inc entity/entity.features.inc
index 2058026..3f5b6a0 100644
--- entity/entity.features.inc
+++ entity/entity.features.inc
@@ -101,11 +101,13 @@ class EntityDefaultFeaturesController {
    */
   function export_render($module, $data, $export = NULL) {
     $output = array();
-    $output[] = '  $items = array(';
+    $output[] = '  $items = array();';
     foreach (entity_load($this->type, $data) as $name => $entity) {
-      $output[] = "    '$name' => " . entity_export($this->type, $entity, '    ') . ',';
+      $output[] = '  $export = <<<EXPORT';
+      $output[] = '  ' . entity_export($this->type, $entity, '  ');
+      $output[] = 'EXPORT;';
+      $output[] = '  $items[' . "'$name'" . '] = entity_import(' . "'$this->type', " . '$export);';
     }
-    $output[] = '  );';
     $output[] = '  return $items;';
     $output = implode("\n", $output);
 
diff --git entity/entity.module entity/entity.module
index 0c95c9b..8273269 100644
--- entity/entity.module
+++ entity/entity.module
@@ -132,7 +132,7 @@ function entity_delete_multiple($entity_type, $ids) {
  *   A new instance of the entity type or FALSE if the given entity type isn't
  *   compatible to the CRUD API.
  */
-function entity_create($entity_type, $values) {
+function entity_create($entity_type, array $values) {
   $info = entity_get_info($entity_type);
   if (in_array('EntityAPIControllerInterface', class_implements($info['controller class']))) {
     return entity_get_controller($entity_type)->create($values);
@@ -150,19 +150,39 @@ function entity_create($entity_type, $values) {
  * @param $prefix
  *   An optional prefix for each line.
  * @return
- *   The exported entity as code.
+ *   The exported entity as serialized string. The format is determined by the
+ *   respective entity controller, e.g. it is JSON for the EntityAPIController.
+ *   The output is suitable for entity_import().
  */
 function entity_export($entity_type, $entity, $prefix = '') {
-  $info = entity_get_info($entity_type);
   if (method_exists($entity, 'export')) {
     return $entity->export($prefix);
   }
-  elseif (in_array('EntityAPIControllerInterface', class_implements($info['controller class']))) {
+  $info = entity_get_info($entity_type);
+  if (in_array('EntityAPIControllerInterface', class_implements($info['controller class']))) {
     return entity_get_controller($entity_type)->export($entity, $prefix);
   }
 }
 
 /**
+ * Imports an entity.
+ *
+ * @param $entity_type
+ *   The type of the entity.
+ * @param string $export
+ *   The string containing the serialized entity as produced by
+ *   entity_export().
+ * @return
+ *   The imported entity object not yet saved.
+ */
+function entity_import($entity_type, $export) {
+  $info = entity_get_info($entity_type);
+  if (in_array('EntityAPIControllerInterface', class_implements($info['controller class']))) {
+    return entity_get_controller($entity_type)->import($export);
+  }
+}
+
+/**
  * Builds a structured array representing the entity's content.
  *
  * The content built for the entity will vary depending on the $view_mode
@@ -205,10 +225,10 @@ function entity_build_content($entity_type, $entity, $view_mode = 'full', $langc
  * @see entity_extract_ids()
  */
 function entity_id($entity_type, $entity) {
-  $info = entity_get_info($entity_type);
-  if (isset($info['entity class']) && method_exists($info['entity class'], 'identifier')) {
+  if (method_exists($entity, 'identifier')) {
     return $entity->identifier();
   }
+  $info = entity_get_info($entity_type);
   $key = isset($info['entity keys']['name']) ? $info['entity keys']['name'] : $info['entity keys']['id'];
   return isset($entity->$key) ? $entity->$key : NULL;
 }
@@ -622,7 +642,7 @@ function entity_forms($form_id, $args) {
  *   initialized with empty values using entity_create(). Thus entities, for
  *   which this is problematic have to care to pass in an initialized entity.
  * @param $op
- *   One of 'edit', 'add' or 'clone. Defaults to edit.
+ *   One of 'edit', 'add' or 'clone'. Defaults to edit.
  *
  * @return
  *   The fully built and processed form, ready to be rendered.
diff --git entity/entity.test entity/entity.test
index 45b50cb..7cc5597 100644
--- entity/entity.test
+++ entity/entity.test
@@ -138,9 +138,11 @@ class EntityAPITestCase extends DrupalWebTestCase {
     $result = entity_load('entity_test_type', array($types['test']->id));
     $this->assertTrue(isset($result['test']), 'Exportable entity loaded by the numeric id.');
 
-    // Test exporting an entity to code.
-    $code = $types['test']->export();
-    $import = eval('return ' . $code . ';');
+    // Test exporting an entity to JSON.
+    $serialized_string = $types['test']->export();
+    $data = drupal_json_decode($serialized_string);
+    $this->assertNotNull($data, 'Exported entity is valid JSON.');
+    $import = entity_import('entity_test_type', $serialized_string);
     $this->assertTrue(get_class($import) == get_class($types['test']) && $types['test']->label == $import->label, 'Successfully exported entity to code.');
     $this->assertTrue(!isset($import->status), 'Exportable status has not been exported to code.');
   }
diff --git entity/entity.ui.inc entity/entity.ui.inc
index 76d95db..165f65d 100644
--- entity/entity.ui.inc
+++ entity/entity.ui.inc
@@ -82,6 +82,20 @@ class EntityDefaultUIController {
       'file' => 'entity.ui.inc',
     );
 
+    if ($this->entityInfo['exportable']) {
+      // Menu item for importing an entity.
+      $items[$this->path . '/import'] = array(
+        'title callback' => 'entity_ui_import_title',
+        'title arguments' => array($this->entityType),
+        'page callback' => 'drupal_get_form',
+        'page arguments' => array($this->entityType . '_operation_form', $this->entityType, NULL, 'import'),
+        'access callback' => 'entity_access',
+        'access arguments' => array('create', $this->entityType),
+        'file' => 'entity.ui.inc',
+        'type' => MENU_LOCAL_ACTION,
+      );
+    }
+
     if (!empty($this->entityInfo['admin ui']['file'])) {
       // Add in the include file for the entity form.
       foreach (array("/manage/$wildcard", "/manage/$wildcard/clone", '/add') as $path_end) {
@@ -178,7 +192,11 @@ class EntityDefaultUIController {
     }
     // Add operations with the right colspan.
     $field_ui = !empty($this->entityInfo['bundle of']) && module_exists('field_ui');
-    $header[] = array('data' => t('Operations'), 'colspan' => $field_ui ? 5 : 3);
+    $exportable = !empty($this->entityInfo['exportable']);
+    $colspan = 3;
+    $colspan = $field_ui ? $colspan + 2 : $colspan;
+    $colspan = $exportable ? $colspan + 1 : $colspan;
+    $header[] = array('data' => t('Operations'), 'colspan' => $colspan);
 
     $render = array(
       '#theme' => 'table',
@@ -221,10 +239,15 @@ class EntityDefaultUIController {
     }
     // In case this is a bundle, we add links to the field ui tabs.
     $field_ui = !empty($this->entityInfo['bundle of']) && module_exists('field_ui');
+    // For exportable entities we add an export link.
+    $exportable = !empty($this->entityInfo['exportable']);
+    $colspan = 3;
+    $colspan = $field_ui ? $colspan + 2 : $colspan;
+    $colspan = $exportable ? $colspan + 1 : $colspan;
 
     // Add operations depending on the status.
     if (entity_has_status($this->entityType, $entity, ENTITY_FIXED)) {
-      $row[] = array('data' => l(t('clone'), $this->path . '/manage/' . $id . '/clone'), 'colspan' => $field_ui ? 5 : 3);
+      $row[] = array('data' => l(t('clone'), $this->path . '/manage/' . $id . '/clone'), 'colspan' => $colspan);
     }
     else {
       $row[] = l(t('edit'), $this->path . '/manage/' . $id);
@@ -245,6 +268,9 @@ class EntityDefaultUIController {
         $row[] = '';
       }
     }
+    if ($exportable) {
+      $row[] = l(t('export'), $this->path . '/manage/' . $id . '/export');
+    }
     return $row;
   }
 
@@ -253,15 +279,48 @@ class EntityDefaultUIController {
    * Builds the operation form.
    */
   public function operationForm($form, &$form_state, $entity, $op) {
-    $label = entity_label($this->entityType, $entity);
     switch ($op) {
       case 'revert':
+        $label = entity_label($this->entityType, $entity);
         $confirm_question = t('Are you sure you want to revert the %entity %label?', array('%entity' => $this->entityInfo['label'], '%label' => $label));
         return confirm_form($form, $confirm_question, $this->path);
 
       case 'delete':
+        $label = entity_label($this->entityType, $entity);
         $confirm_question = t('Are you sure you want to delete the %entity %label?', array('%entity' => $this->entityInfo['label'], '%label' => $label));
         return confirm_form($form, $confirm_question, $this->path);
+
+      case 'export':
+        if (!empty($this->entityInfo['exportable'])) {
+          $export = entity_export($this->entityType, $entity);
+          $form['export'] = array(
+            '#type' => 'textarea',
+            '#title' => t('Export'),
+            '#description' => t('For importing copy the content of the text area and paste it into the import page.'),
+            '#rows' => 25,
+            '#default_value' => $export,
+          );
+          return $form;
+        }
+
+      case 'import':
+        $form['import'] = array(
+          '#type' => 'textarea',
+          '#title' => t('Import'),
+          '#description' => t('Paste an exported %entity_type here.', array('%entity_type' => $this->entityInfo['label'])),
+          '#rows' => 20,
+        );
+        $form['overwrite'] = array(
+          '#title' => t('Overwrite'),
+          '#type' => 'checkbox',
+          '#description' => t('If checked, any existing %entity with the same identifier will be replaced by the import.', array('%entity' => $this->entityInfo['label'])),
+          '#default_value' => FALSE,
+        );
+        $form['submit'] = array(
+          '#type' => 'submit',
+          '#value' => t('Import'),
+        );
+        return $form;
     }
     drupal_not_found();
     exit;
@@ -270,7 +329,27 @@ class EntityDefaultUIController {
   /**
    * Operation form validation callback.
    */
-  public function operationFormValidate($form, &$form_state) { }
+  public function operationFormValidate($form, &$form_state) {
+    if ($form_state['op'] == 'import') {
+      if ($entity = entity_import($this->entityType, $form_state['values']['import'])) {
+        // Store the successfully imported entity in $form_state.
+        $form_state[$this->entityType] = $entity;
+        if (!$form_state['values']['overwrite']) {
+          // Check for existing entities with the same identifier.
+          $id = entity_id($this->entityType, $entity);
+          $entities = entity_load($this->entityType, array($id));
+          if (!empty($entities)) {
+            $label = entity_label($this->entityType, $entity);
+            $vars = array('%entity' => $this->entityInfo['label'], '%label' => $label);
+            form_set_error('import', t('Import of %entity %label failed, a %entity with the same machine name already exists. Check the overwrite option to replace it.', $vars));
+          }
+        }
+      }
+      else {
+        form_set_error('import', t('Import failed.'));
+      }
+    }
+  }
 
   /**
    * Operation form submit callback.
@@ -285,7 +364,7 @@ class EntityDefaultUIController {
    * Applies an operation to the given entity.
    *
    * @param string $op
-   *   The operation (edit, clone, revert or delete).
+   *   The operation (revert, delete or import).
    * @param $entity
    *   The entity to manipulate.
    *
@@ -309,6 +388,20 @@ class EntityDefaultUIController {
         watchdog($this->entityType, 'Deleted %entity %label.', $vars);
         return t('Deleted %entity %label.', $vars);
 
+      case 'import':
+        // First check if there is any existing entity with the same ID.
+        $id = entity_id($this->entityType, $entity);
+        $entities = entity_load($this->entityType, array($id));
+        if ($existing_entity = reset($entities)) {
+          // Copy DB id and remove the new indicator to overwrite the DB record.
+          $idkey = $this->entityInfo['entity keys']['id'];
+          $entity->{$idkey} = $existing_entity->{$idkey};
+          unset($entity->is_new);
+        }
+        entity_save($this->entityType, $entity);
+        watchdog($this->entityType, 'Imported %entity %label.', $vars);
+        return t('Imported %entity %label.', $vars);
+
       default:
         return FALSE;
     }
@@ -440,6 +533,11 @@ function entity_ui_get_page_title($op, $entity_type, $entity = NULL) {
       return t('Revert @label', array('@label' => $label));
     case 'delete':
       return t('Delete @label', array('@label' => $label));
+    case 'export':
+      return t('Export @label', array('@label' => $label));
+    case 'import':
+      $info = entity_get_info($entity_type);
+      return t('Import @entity_type', array('@entity_type' => $info['label']));
   }
 }
 
@@ -452,6 +550,15 @@ function entity_ui_add_title($entity_type) {
 }
 
 /**
+ * Menu title callback for the 'Import' menu item.
+ */
+function entity_ui_import_title($entity_type) {
+  $entity_info = entity_get_info($entity_type);
+  return t('Import a @entity', array('@entity' => drupal_strtolower($entity_info['label'])));
+}
+
+
+/**
  * Submit builder for the main entity form, which extracts the form values and updates the entity.
  *
  * This is a helper function for entities making use of the entity UI
