Skip to content

Latest commit

 

History

History
87 lines (62 loc) · 2.17 KB

File metadata and controls

87 lines (62 loc) · 2.17 KB

OfficeIMO.Reader.Json - JSON reader adapter

nuget version nuget downloads

OfficeIMO.Reader.Json provides a modular JSON ingestion adapter for OfficeIMO.Reader.Core.

Install

dotnet add package OfficeIMO.Reader.Json

Configure

using OfficeIMO.Reader;
using OfficeIMO.Reader.Json;

OfficeDocumentReader reader = new OfficeDocumentReaderBuilder()
    .AddJsonHandler()
    .Build();

Examples

Convert JSON paths into chunks

using OfficeIMO.Reader;
using OfficeIMO.Reader.Json;

OfficeDocumentReader reader = new OfficeDocumentReaderBuilder()
    .AddJsonHandler(new JsonReadOptions {
        ChunkRows = 100,
        MaxDepth = 16,
        IncludeMarkdown = true
    })
    .Build();

foreach (var chunk in reader.Read("appsettings.json", new ReaderOptions {
    MaxInputBytes = 5L * 1024L * 1024L
})) {
    Console.WriteLine(chunk.Markdown ?? chunk.Text);
}

Read a JSON stream

using OfficeIMO.Reader;
using OfficeIMO.Reader.Json;

OfficeDocumentReader reader = new OfficeDocumentReaderBuilder()
    .AddJsonHandler()
    .Build();

await using var stream = File.OpenRead("payload.json");
var chunks = reader.Read(stream, "payload.json", new ReaderOptions {
    MaxChars = 3_000
}).ToList();

What it emits

  • AST traversal through System.Text.Json.
  • Path/type/value rows.
  • Chunked structured output with optional Markdown tables.
  • Path and stream dispatch.
  • Warning chunks for malformed JSON.

Boundaries

  • Reader adapter configuration belongs here.
  • Shared extraction contracts belong in OfficeIMO.Reader.Core.

Targets and license

  • Targets: netstandard2.0, net8.0, net10.0.
  • License: MIT.

Dependency footprint

  • External: System.Text.Json.
  • OfficeIMO: OfficeIMO.Reader.Core owns chunking, limits, locations, warnings, and result projection.

See the complete OfficeIMO package map for related formats and conversion paths.