---
title: "Extracting JSON data from a PDF document | Nutrient .NET SDK"
canonical_url: "https://www.nutrient.io/guides/dotnet/csharp/extraction/json-data-extraction/"
md_url: "https://www.nutrient.io/guides/dotnet/csharp/extraction/json-data-extraction.md"
last_updated: "2026-10-08T00:00:00.000Z"
description: "How to extract structured data from a PDF as JSON using Nutrient .NET SDK."
---

# Extracting JSON data from a PDF document

Extract structured data from PDF files as JSON for storage, API workflows, or analytics pipelines. This approach reduces manual entry and gives your application direct access to document content.

[Download sample](https://www.nutrient.io/downloads/samples/csharp/json-data-extraction.zip)

## How Nutrient supports this workflow

Nutrient.NET SDK handles structured extraction from PDF documents, including digital-native PDFs and PDFs that mix digital text with scanned content.

In this sample, `VisionEngine.AdaptiveOcr` uses an adaptive extraction pipeline that prefers native PDF text when available and falls back to OCR for image-based content when needed.

You don’t need to manage:

- Third-party OCR engine integration

- Switching between native-text extraction and OCR

- Document layout parsing

- Model download and initialization

- Conversion from extracted output to structured data

Use the SDK API to extract structured JSON in your application.

## Complete implementation

This example shows a complete PDF-to-JSON extraction flow.

Import the Nutrient namespace:

```csharp

using Nutrient;

```

Open the PDF document inside a [using statement](https://learn.microsoft.com/dotnet/csharp/language-reference/statements/using). The `using` statement closes the document automatically:

```csharp

try
{
    using Document document = Document.Open("input.pdf");

```

Configure the Adaptive OCR engine, extract JSON content, and write it to `output.json`. Catch `NutrientException` to handle SDK errors:

```csharp

    document.Settings.VisionSettings.Engine = VisionEngine.AdaptiveOcr;

    Vision vision = Vision.Set(document);
    string contentJson = vision.ExtractContent();

    File.WriteAllText("output.json", contentJson);

    Console.WriteLine("Successfully extracted content to output.json");
}
catch (NutrientException e)
{
    Console.Error.WriteLine($"Error: {e.Message}");
    Environment.Exit(1);
}

```

## Summary

The extraction flow has four steps:

1. Open the PDF document.

2. Configure the Adaptive OCR engine.

3. Extract content as JSON with `Vision`.

4. Write the JSON output to a file.

Nutrient handles adaptive extraction and content structuring, so you don’t need to implement PDF parsing, native-text detection, or OCR fallback logic.

## Barcode data in JSON output

For documents that contain machine-readable codes, Vision extraction includes detected barcode data in the document layout output. Each detected barcode is represented as a layout element with the decoded value and barcode symbology, such as 1D barcodes, QR codes, Micro QR codes, PDF417, DataMatrix, Aztec, or MaxiCode.

Use this output when a pipeline needs both document text and embedded barcode values from the same pass. To focus specifically on barcodes, refer to the [read barcodes with Vision](https://www.nutrient.io/guides/dotnet/csharp/extraction/read-barcodes-with-vision.md) guide.

You can download [this sample package](https://www.nutrient.io/downloads/samples/csharp/json-data-extraction.zip) to run the example locally.
---

## Related pages

- [Nutrient .NET SDK extraction guides](/guides/dotnet/csharp/extraction.md)
- [Applying OCR to a PDF page](/guides/dotnet/csharp/extraction/apply-ocr-to-pdf-page.md)
- [Applying OCR to a PDF document](/guides/dotnet/csharp/extraction/apply-ocr-to-pdf.md)
- [Classifying documents](/guides/dotnet/csharp/extraction/classify-document.md)
- [Generating image descriptions using Claude](/guides/dotnet/csharp/extraction/describe-image-with-claude.md)
- [Generating image descriptions using local AI](/guides/dotnet/csharp/extraction/describe-image-with-local-ai.md)
- [Generating image descriptions using OpenAI](/guides/dotnet/csharp/extraction/describe-image-with-openai.md)
- [Detecting document language](/guides/dotnet/csharp/extraction/detect-document-language.md)
- [Extracting data from images using ICR](/guides/dotnet/csharp/extraction/extract-data-from-image-icr.md)
- [Extracting data from images using OCR](/guides/dotnet/csharp/extraction/extract-data-from-image-ocr.md)
- [Extracting data from images using vision language models](/guides/dotnet/csharp/extraction/extract-data-from-image-vlm.md)
- [Extracting data from specific pages](/guides/dotnet/csharp/extraction/extract-data-from-specific-pages.md)
- [Extracting form fields from images](/guides/dotnet/csharp/extraction/extract-form-fields-from-image.md)
- [Extracting structured data from documents](/guides/dotnet/csharp/extraction/extract-structured-data.md)
- [Generating extraction schemas](/guides/dotnet/csharp/extraction/generate-extraction-schema.md)
- [Labeling form fields with a vision language model](/guides/dotnet/csharp/extraction/label-form-fields-with-vlm.md)
- [Parsing a document into structured content](/guides/dotnet/csharp/extraction/parse-document.md)
- [Extracting text from PDF documents](/guides/dotnet/csharp/extraction/pdf-to-text.md)
- [Reading barcodes with vision extraction](/guides/dotnet/csharp/extraction/read-barcodes-with-vision.md)
- [Extracting text from multilingual images](/guides/dotnet/csharp/extraction/read-text-from-image-multi-language.md)
- [Extracting text from images](/guides/dotnet/csharp/extraction/read-text-from-image.md)
- [Searching document text](/guides/dotnet/csharp/extraction/search-document-text.md)
- [Speeding up first ICR operation by predownloading models](/guides/dotnet/csharp/extraction/speed-up-first-icr-by-downloading-requirements.md)

