with open('output_contacts.vcf', 'w', encoding='utf-8') as vcf_file:
for contact in contacts:
vcf_file.write("BEGIN:VCARD\n")
vcf_file.write("VERSION:3.0\n")
# Write Full Name
if 'name' in contact:
vcf_file.write(f"FN:contact['name']\n")
# Write Phone Number
if 'phone' in contact:
vcf_file.write(f"TEL:contact['phone']\n")
# Write Email
if 'email' in contact:
vcf_file.write(f"EMAIL:contact['email']\n")
# Write Company
if 'company' in contact:
vcf_file.write(f"ORG:contact['company']\n")
vcf_file.write("END:VCARD\n")
vcf_file.write("\n") # Blank line between contacts
print("Conversion complete! Check output_contacts.vcf")
| Feature | Benefit |
|---------|---------|
| Auto‑detect JSON structure | No manual mapping for standard exports (e.g., from Google Contacts JSON). |
| Preserve custom fields | Map unknown JSON keys to X- extension properties. |
| Photo handling | If JSON contains base64‑encoded image or URL, embed photo in vCard (PHOTO). |
| Groups/Categories | Convert JSON group labels to vCard CATEGORIES. |
| Internationalization | Support Unicode names, addresses, and notes (UTF‑8). |
| CLI version | For developers: json2vcf input.json -o output.vcf. |
| REST API | POST JSON → receive VCF file (for integration with other apps). |
| Privacy filter | Strip or mask certain fields (e.g., remove secondary phone numbers). |
For recurring conversions (e.g., new JSON entries from a webhook → VCF added to Google Drive): json to vcf converter
JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write, and easy for machines to parse and generate.
Structure of a JSON Contact: A typical JSON contact list looks like this:
[
"name": "John Doe",
"phone": "+1234567890",
"email": "john.doe@example.com",
"company": "Acme Inc."
,
"name": "Jane Smith",
"phone": "+1987654321",
"email": "jane.smith@example.com"
]
Pros of JSON: Excellent for web APIs, databases, and configuration files. It preserves complex data structures. Cons of JSON: Not recognized by email clients, CRM systems, or mobile phone address books. with open('output_contacts
Before you start your conversion, ensure you have checked these boxes:
| Scenario | Why You Need It | |----------|----------------| | API → Phone | Export contacts from a backend API (JSON) to your Android/iOS address book. | | CRM Export | Many CRMs export JSON but import VCF. | | Data Migration | Moving from a custom database to Google Contacts or Outlook. | | Backup & Restore | Keep a readable JSON backup but convert to VCF for restoration. |
These require no installation. Upload your JSON, download VCF. print("Conversion complete
Pros: Instant, free, no setup. Cons: Privacy concerns (sensitive contact data is sent to a server), file size limits (usually <5MB).
A minimal vCard example:
BEGIN:VCARD
VERSION:4.0
FN:John Doe
TEL;TYPE=work:+1234567890
EMAIL;TYPE=home:john@example.com
END:VCARD
Key rules: