A simple command-line tool to convert WhatsApp chat exports into clean JSON format.
- Convert WhatsApp chat export files to JSON
- Preserves message order and multi-line messages
- Handles media message indicators
- Simple command-line interface
- Optional pretty-printing of output
- Custom output file naming
npm install -g whatsapp-chat-parser-cli
- Open WhatsApp
- Open the chat you want to export
- Click the three dots menu (⋮)
- Select 'More' > 'Export chat'
- Choose 'Without media'
- Save the exported .txt file
Basic usage:
whatsapp-parser chat.txt
With options:
whatsapp-parser chat.txt -o output.json -f
-o, --output <path>
- Specify output file path (default: chat-output.json)-f, --format
- Format JSON output (pretty print)-h, --help
- Display help information-V, --version
- Display version number
The parser generates a JSON array where each element represents a message:
[
{
"sender": "John Doe",
"message": "Hello world!"
},
{
"sender": "Jane Smith",
"message": "Hi there!"
}
]
- Basic parsing:
whatsapp-parser WhatsApp.txt
- Save to a specific file with pretty printing:
whatsapp-parser WhatsApp.txt -o parsed-chat.json -f
- Display help:
whatsapp-parser --help
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
- Currently only supports the default WhatsApp export format
- Media files are marked as
"Media omitted"
in the output - System messages (like "Messages and calls are end-to-end encrypted") are ignored
This project is licensed under the MIT License - see the LICENSE file for details.
Siddhesh Sonawane
- Inspired by the need to analyze WhatsApp chat data
- Built with Node.js and Commander.js
For support, issues, or feature requests, please create an issue in the GitHub repository.