# JSON Import

<figure><img src="https://762006384-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MJXOXEifAmpyvNVL1to%2Fuploads%2FPqv4bjDQFUjXkCCPjOEg%2FImport-Keeper-JSON.jpg?alt=media&#x26;token=5239dfdd-e2b1-413f-b3f5-bd17efbcf6ac" alt=""><figcaption></figcaption></figure>

## **JSON Record Import**

JSON import files can contain records, folders, subfolders, shared folders, default folder permissions and user/team permissions. JSON can also be used to structure KeeperPAM resources.

Below is a JSON import file with 2 records. The first record is added to a folder called "My Websites\\\Online". The second record is added to "Social Media" and also added to a shared folder called "Shared Social".

The import file example below is an array of record objects which can import into private folders and shared folders. Note in the example that the Facebook record contains a TOTP seed which will render on the Vault user interface and Commander CLI.

{% code overflow="wrap" lineNumbers="true" %}

```json
{
  "records": [{
    "title":"Google",
    "folders": [
      {
        "folder": "My Websites\\Online"
      }
    ],
    "login": "testing",
    "password": "lk4j139sk4j",
    "login_url": "https://google.com",
    "notes": "These are some notes.",
    "custom_fields": {"Favorite Food":"Cheetos"}
  },
  {
    "title":"Facebook",
    "folders": [
      {
        "folder": "Social Media"
      },
      {
        "shared_folder": "Shared Social",
        "can_edit": false,
        "can_share": false
      }
    ],
    "login": "me@gmail.com",
    "password": "123123123123",
    "login_url": "https://facebook.com",
    "notes": "This is our corporate shared record.",
    "custom_fields": {
      "Facebook Application ID":"ABC12345",
      "$oneTimeCode": "otpauth://totp/Amazon:me@company.com?secret=JBSWY3DPEHPK3PXP&issuer=Amazon&algorithm=SHA1&digits=6&period=30"}
  }]
}
```

{% endcode %}

Another example below first creates shared folders that are shared to users and teams, then imports records into the shared folders. The format of the file is slightly different and allows you to separate the creation of shared folder objects and records:

{% code overflow="wrap" lineNumbers="true" %}

```json
{
  "shared_folders": [
    {
      "path": "My Customer 1",
      "manage_users": true,
      "manage_records": true,
      "can_edit": true,
      "can_share": true,
      "permissions": [
        {
          "uid": "kVM96KGEoGxhskZoSTd_jw",
          "manage_users": true,
          "manage_records": true
        },
        {
          "name": "user@mycompany.com",
          "manage_users": true,
          "manage_records": true
        }
      ]
    },
    {
      "path": "Testing\\My Customer 2",
      "manage_users": true,
      "manage_records": true,
      "can_edit": true,
      "can_share": true,
      "permissions": [
        {
          "uid": "ih1CggiQ-3ENXcn4G0sl-g",
          "manage_users": true,
          "manage_records": true
        },
        {
          "name": "user@mycompany.com",
          "manage_users": true,
          "manage_records": true
        }
      ]
    }
  ],
  "records": [
    {
      "title": "Bank Account 1",
      "login": "customer1234",
      "password": "4813fJDHF4239fdk",
      "login_url": "https://chase.com",
      "notes": "These are some notes.",
      "custom_fields": {
        "Account Number": "123-456-789"
      },
      "folders": [
        {
          "folder": "Optional Private Folder 1"
        }
      ]
    },
    {
      "title": "Bank Account 2",
      "login": "mybankusername",
      "password": "w4k4k193f$^&@#*%2",
      "login_url": "https://amex.com",
      "notes": "Some great information here.",
      "custom_fields": {
        "Security Group": "Public",
        "IP Address": "12.45.67.8"
      },
      "folders": [
        {
          "folder": "Optional Private Folder 1"
        },
        {
          "shared_folder": "My Customer 1",
          "can_edit": true,
          "can_share": true
        }
      ]
    }
  ]
}
```

{% endcode %}

The format must be strict JSON or it will fail parsing. To import this file:

```
import --format=json import.json
```

To apply the suggested user and team permissions, run the command a second time using the --users flag:

```
import --format=json --users import.json
```

{% hint style="info" %}
The `--users` flag applies permissions similar to the apply-membership command. You can execute the command with the `--users` flag repeatedly.
{% endhint %}

There are more complex import file examples that supports shared folders, folder permissions, user permissions and team permissions located in the sample\_data/ folder. To import the sample JSON file into your vault, type this command:

* Example 1: [import.json.txt](https://github.com/Keeper-Security/Commander/blob/master/sample_data/import.json.txt)
* Example 2: [import\_records\_existing\_folders.json.txt](https://github.com/Keeper-Security/Commander/blob/master/sample_data/import_records_existing_folders.json.txt)
* Example 3: [import\_records\_into\_folders.json.txt](https://github.com/Keeper-Security/Commander/blob/master/sample_data/import_records_into_folders.json.txt)
* Example 4: [import\_shared\_folders.json.txt](https://github.com/Keeper-Security/Commander/blob/master/sample_data/import_shared_folders.json.txt)
* Example 5: [import\_shared\_folders\_and\_records.json.txt](https://github.com/Keeper-Security/Commander/blob/master/sample_data/import_shared_folders_and_records.json.txt)

```
import --format=json sample_data/import.json.txt
import --format=json --users sample_data/import.json.txt
```

The sample file contains "permissions" objects that contain email address or team names. If the email or team name exists in your Keeper enterprise account, they will be added to the shared folder, otherwise the information is ignored.

***

### JSON PAM Resource Import

Keeper Commander's `pam project import` feature helps customers to automate the creation of PAM resources: folders, gateways, machines, users, connections, tunnels and (optionally) rotations.

See: [`pam project import`](https://docs.keeper.io/en/keeperpam/commander-cli/keeperpam-commands#sub-command-project) command.

**Import JSON Documentation**

* A step-by-step guide to importing Windows Servers as PAM Resources from a basic list of server hostnames can be found at this page: [Importing PAM Resources](https://docs.keeper.io/en/keeperpam/privileged-access-manager/references/importing-pam-resources)​
* A more detailed specification for "`pam project import`" templates can be found at this [GitHub README Page](https://github.com/Keeper-Security/Commander/blob/master/keepercommander/commands/pam_import/README.md)​
* If you require assistance, contact the Commander team (<commander@keepersecurity.com>).
