MarcusMedina.Fluent.Data 1.0.1

dotnet add package MarcusMedina.Fluent.Data --version 1.0.1
                    
NuGet\Install-Package MarcusMedina.Fluent.Data -Version 1.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MarcusMedina.Fluent.Data" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MarcusMedina.Fluent.Data" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="MarcusMedina.Fluent.Data" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MarcusMedina.Fluent.Data --version 1.0.1
                    
#r "nuget: MarcusMedina.Fluent.Data, 1.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package MarcusMedina.Fluent.Data@1.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=MarcusMedina.Fluent.Data&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=MarcusMedina.Fluent.Data&version=1.0.1
                    
Install as a Cake Tool

MarcusMedina.Fluent.Data

NuGet NuGet Downloads C# .NET License: MIT Open Source Build Signed Wiki

Fluent data format extensions for CSV, JSON, and XML in .NET 10+

Convert between strings, objects, and structured data with a clean fluent API — perfect for file import/export, API responses, and data transformation pipelines.

This started as a C++ tool built for a tenant association — reading laundry-room access-tag logs to work out who kept stealing other residents' booked slots. Years later it turned into a fun assignment for my students: read the logs, identify whose tag was used, work out who went in and out and how long they stayed — extended so we could also track people entering and leaving the building itself. It's stuck with me ever since as a reminder never to get sloppy with CSV/JSON when importing real-world data.

In this case, I wanted a fluent layer solid enough that I'd trust it with real log data again, not just toy examples.


Features

  • ✅ CSV — Parse and generate CSV lines, fields, and full documents (with escaping)
  • ✅ JSON — Serialize/deserialize objects, validate JSON strings, escape content
  • ✅ XML — Build XML elements and attributes fluently, escape XML content
  • ✅ Fluent API — Chain operations naturally
  • ✅ Type-Safe — Full generics support for FromCsv<T> with custom mapping
  • ✅ Zero dependencies — Pure .NET, no external packages

Installation

dotnet add package MarcusMedina.Fluent.Data

Requirements: .NET 10.0+, C# 14.0+


Quick Start

CSV

using MarcusMedina.Fluent.Data;

// Parse CSV
var csv = "\"Hello, world\",42,true";
var fields = csv.SplitCsvLine();

// Build CSV
var line = new[] { "Hello, world", "42", "true" }.ToCsvLine();
// => "Hello, world",42,true

// Full document
var records = new[] {
    new[] { "Alice", "30" },
    new[] { "Bob", "25" }
};
var doc = records.ToCsvDocument();

JSON

// Objects to/from JSON
var json = new { Name = "Alice", Age = 30 }.ToJson();
var person = json.FromJson<Person>();

// Validate
bool valid = json.IsValidJson();

XML

// Build XML elements
var attrs = new[] {
    new KeyValuePair<string, object?>("id", 42),
    new KeyValuePair<string, object?>("name", "Alice")
};
string xml = attrs.ToXmlElement("person", "Hello");
// => <person id="42" name="Alice">Hello</person>

API Overview

Method Description
ToCsvField() Escape a string for CSV (quotes, commas, newlines)
FromCsvField() Unescape a CSV field value
SplitCsvLine() Parse a CSV line into fields
ToCsvLine() Join fields into a CSV line
ToCsvDocument() Generate a multi-line CSV document
FromCsvDocument() Parse a CSV document into rows
FromCsv<T>() Parse CSV with custom mapping
ToJson() Serialize object to JSON
FromJson<T>() Deserialize JSON to object
IsValidJson() Validate JSON string
ToXmlContent() Escape string for XML content
FromXmlContent() Unescape XML content
ToXmlAttributes() Build XML attribute string
ToXmlElement() Build XML element string

Testing

dotnet test --configuration Release

Tests: 97 passed — covering CSV escaping edge cases, JSON validation, XML generation.


License

MIT — see LICENSE for details.


Built with Human + AI Collaboration

This library was written by Marcus Medina together with Claude Code (Anthropic) — not through "vibe coding" where you just describe and accept, but through genuine collaboration: planning together, reviewing each other's decisions, pushing back when something felt wrong, and iterating until the result felt right.

The goal was always to write code worth reading and code worth using — the kind a student can open, understand, and learn from, and the kind any programmer can drop into real, professional work without wanting to rewrite it from scratch. AI was a partner in that process, not a shortcut around it.

If you're curious about this way of working, the source code and git history are open. Every decision has a reason behind it.

Made for Curious Minds

This library was built with students in mind — not as a black box to copy and paste, but as a real-world example of how clean, purposeful code is written and shared.

Whether you're discovering C# for the first time, need a reliable helper for your school project, or are simply trying to fall in love with writing code — you're exactly who this was made for.

The source is open. Read it, fork it, break it, improve it. That's the whole point.

And if this library saved you an afternoon, or made something click that didn't before — that's everything.

Non-students are equally welcome. Good code doesn't care about your diploma.

⭐ If this helped you, consider starring the project on GitHub — it helps other students find it too.

💬 Have an idea, a feature request, or just want to say hi? Open an issue on GitHub — I'd love to hear from you.

Package Integrity

All releases are signed with cosign (Sigstore keyless signing).

To verify a downloaded package, download both the .nupkg and its .sigstore.json bundle from the GitHub Release, then run:

cosign verify-blob <package.nupkg> \
  --bundle <package.nupkg.sigstore.json> \
  --certificate-identity-regexp "https://github.com/MarcusMedinaPro/.*/release.yml" \
  --certificate-oidc-issuer https://token.actions.githubusercontent.com

Expected output: Verified OK

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.1 133 7/3/2026
1.0.0 129 6/30/2026