WhatsAppChatParser 2.1.0

Parser for exported WhatsApp chats

Install-Package WhatsAppChatParser -Version 2.1.0
dotnet add package WhatsAppChatParser --version 2.1.0
<PackageReference Include="WhatsAppChatParser" Version="2.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add WhatsAppChatParser --version 2.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: WhatsAppChatParser, 2.1.0"
For F# scripts that support #r syntax, copy this into the source code to reference the package.

WhatsAppChatParser

A C# parser for exported WhatsApp chat histories

Nuget Version Nuget

GitHub last commit GitHub Release Date GitHub

Usage

Parsing

using WhatsAppChatParser;

static void Main(string[] args)
{

    private readonly string filePath = @"C:\..\..WhatsApp Chat with John Doe.txt";

    // Read from file path
    IEnumerable<Message> chats = WhatsAppChat.Parse(filePath);

    // Read from stream
    chats = WhatsAppChat.Parse(new FileStream(filePath, FileMode.Open));

    foreach(var chat in chats)
        Console.WriteLine($"{chat.MessageBy} said {chat.Text} at {chat.TimeStamp}");
}

Data Serialization

WhatsAppChatParser exposes extension methods to serialize the chat list.

To JSON

JSON serialization is handled internally using Newtonsoft.Json. All the JsonConvert.SerializeObject overloads are supported.

using Newtonsoft.Json;
using WhatsAppChatParser;

static void Main(string[] args)
{

    private readonly string filePath = @"C:\..\..WhatsApp Chat with John Doe.txt";
    var chats = WhatsAppChat.Parse(filePath);

    var json = chats.ToJSON(); 
    var indentedJson = chats.ToJSON(Formatting.Indented);
}

To XML

XML serialization is handled internally using System.Xml.Serialization.XmlSerializer.

using Newtonsoft.Json;
using WhatsAppChatParser;

static void Main(string[] args)
{

    private readonly string filePath = @"C:\..\..WhatsApp Chat with John Doe.txt";
    var chats = WhatsAppChat.Parse(filePath);

    var xml = chats.ToXML(); 
}

WhatsAppChatParser

A C# parser for exported WhatsApp chat histories

Nuget Version Nuget

GitHub last commit GitHub Release Date GitHub

Usage

Parsing

using WhatsAppChatParser;

static void Main(string[] args)
{

    private readonly string filePath = @"C:\..\..WhatsApp Chat with John Doe.txt";

    // Read from file path
    IEnumerable<Message> chats = WhatsAppChat.Parse(filePath);

    // Read from stream
    chats = WhatsAppChat.Parse(new FileStream(filePath, FileMode.Open));

    foreach(var chat in chats)
        Console.WriteLine($"{chat.MessageBy} said {chat.Text} at {chat.TimeStamp}");
}

Data Serialization

WhatsAppChatParser exposes extension methods to serialize the chat list.

To JSON

JSON serialization is handled internally using Newtonsoft.Json. All the JsonConvert.SerializeObject overloads are supported.

using Newtonsoft.Json;
using WhatsAppChatParser;

static void Main(string[] args)
{

    private readonly string filePath = @"C:\..\..WhatsApp Chat with John Doe.txt";
    var chats = WhatsAppChat.Parse(filePath);

    var json = chats.ToJSON(); 
    var indentedJson = chats.ToJSON(Formatting.Indented);
}

To XML

XML serialization is handled internally using System.Xml.Serialization.XmlSerializer.

using Newtonsoft.Json;
using WhatsAppChatParser;

static void Main(string[] args)
{

    private readonly string filePath = @"C:\..\..WhatsApp Chat with John Doe.txt";
    var chats = WhatsAppChat.Parse(filePath);

    var xml = chats.ToXML(); 
}

Release Notes

Support ToXML extension for chat list

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
2.1.0 673 8/27/2019
2.0.0 353 5/7/2019
1.1.0 236 5/6/2019
1.0.1 219 5/3/2019
1.0.0 263 5/3/2019