Skip to main content

Whatsapp-Text-To-Json-Converter

Converts Whatsapp chat files to dictionary or JSON format.

Works with exports from iPhone and Android. Be sure to mention device.

Installation

pip install whatsapptojson

Using Command Line Arguments

whatsapptojson [OPTIONS]

usage: whatsapptojson [-h] -f FILE -d DEVICE [-s SAVE] [-v]

optional arguments:
  -h, --help            show this help message and exit
  -f FILE, --file FILE  chat text file
  -d DEVICE, --device DEVICE
                        can be 'iphone' or 'android'
  -s SAVE, --save SAVE  path of file/direction to save json, 'default' would
                        be same as text file name in same directory
  -v, --verbose         Verbose (Print output)

Using Native Python

whatsapptojson.format() - to convert a read text to dictionary

whatsapptojson.format_file() - to read file from text to dictionary/json

be sure to mention device attribute correctly iphone or android.

from whatsapptojson import whatsapptojson

# Converting Text to Dict
output = whatsapptojson.format(text = 'string with complete chat data', device = 'android')

# Converting File to dictionary.
output = whatsapptojson.format_file(source='source_file_path', device = 'iphone')

# Converting File to dictionary.
output = whatsapptojson.format_file(source='source_file_path', device = 'iphone')

### Whatsapp File to Json.
whatsapptojson.format_file(source='source_file_path', destination='destination_path.json', device = 'android')

Sample Export

{
  "attachment_extensions": [
    "pdf",
    "mp4",
    "jpg"
  ],
  "participants": [
    "sender name 1",
    "sender name 2",
    "sender name n"
  ],
  "chats": [
    {
      "date": "25/03/16 07:03:45 PM",
      "message": "‎Messages to this group are now secured with end-to-end encryption.",
      "type": "whatsapp meta"
    },
     {
      "date": "15/08/17 12:27:34 PM",
      "message": "message for attachment",
      "sender": "sender name",
      "type": "attachment",
      "attachment": {
        "file_name": "file_name_with.pdf",
        "meta": "8 pages",
        "extention": "pdf"
      }
    },  {
      "date": "15/08/17 01:37:28 PM",
      "sender": "sender name",
      "message": "message",
      "type": "conversation"
    },
    ...
    ]
}

Each item in chats could have type of "whatsapp meta" or "attachment" or "conversation".

Metadata

Release files for whatsapptojson 1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for whatsapptojson 1.0
File Size Uploaded Provenance Actions
whatsapptojson-1.0.tar.gz 4.5 kB Without provenance Details for whatsapptojson-1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for whatsapptojson 1.0
File Interpreter ABI Platform Actions
whatsapptojson-1.0-py3-none-any.whl Python 3 none any Details for whatsapptojson-1.0-py3-none-any.whl

Total release size: 10.6 kB

Release files / whatsapptojson-1.0.tar.gz

Download URL whatsapptojson-1.0.tar.gz
Size 4.5 kB
Tags Source
SHA-256 checksum
How to use checksums
7fc5f6847522447fba9b191cd2f7961a9aed9390f4d21effda63f3bfe5cb01d8
BLAKE2b-256 checksum
How to use checksums
ce1fd8d9ef3f303d74c8cda5e5d44eec90a1bc71cd1993368eb1f049421a8186
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.18.4 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.23.3 CPython/3.6.3

Release files / whatsapptojson-1.0-py3-none-any.whl

Download URL whatsapptojson-1.0-py3-none-any.whl
Size 6.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
979bc8ce1e4680a825981bc7395021dffd27007f88a656022e0fd8f1f7c6b3e5
BLAKE2b-256 checksum
How to use checksums
170cfb0c4eb3812baaba4b4969dc82d60b7cf569f2695d1689938c477d64bd3e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.18.4 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.23.3 CPython/3.6.3

Security for whatsapptojson 1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page