agentleFS
aspose-cellsaspose-cells/agentic-net-examples/working-with-json/AGENTS.md

agentic-net-examples / working-with-json

AGENTS.md1 starsChanged 29 days agoMITView on GitHub

Create focused C# examples for tabular JSON-to-cell import and worksheet-range-to-JSON export. Follow ../AGENTS.md, then this guide. Existing generated files are discovery candidates only. In scope: JsonUtility.ImportData, JsonLayoutOptions, JsonUtility.ExportRangeToJson, JsonSaveOptions, tabular arrays, nested layout, null/title/type handling, range selection, and deterministic validation. Out of scope: general JSON object modeling, schema validation, encryption, network fetching, CSV streaming frameworks, arbitrary flattening engines, and unverified workbook-wide JSON claims. Export pattern: Examples must be complete single-file programs with explicit types, inline deterministic JSON by default, one…

The file

We split this AGENTS.md into the rules it gives an agent

5 rules. About 0 are common, 2 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Create focused C# examples for tabular JSON-to-cell import and worksheet-range-to-JSON export.

    line 22
  2. Distinctive:

    Import offsets are zero-based.

    line 76
  3. Distinctive:

    Verify version-sensitive layout properties before use.

    line 77
  4. Very specific:

    Prefer the current ExportRangeToJson(Range, JsonSaveOptions) signature.

    line 78
  5. Very specific:

    Use ImportData for JSON text to cells and ExportRangeToJson for cells to JSON.

    line 93

≈ “Common” is an estimate: at least 1 in 5 of the 45,344 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

Aspose.Cells JSON Agent Instructions

Mission, precedence, and boundary

Create focused C# examples for tabular JSON-to-cell import and worksheet-range-to-JSON export. Follow ../AGENTS.md, then this guide. Existing generated files are discovery candidates only.

In scope: JsonUtility.ImportData, JsonLayoutOptions, JsonUtility.ExportRangeToJson, JsonSaveOptions, tabular arrays, nested layout, null/title/type handling, range selection, and deterministic validation.

Out of scope: general JSON object modeling, schema validation, encryption, network fetching, CSV streaming frameworks, arbitrary flattening engines, and unverified workbook-wide JSON claims.

Canonical answer

using System;
using Aspose.Cells;
using Aspose.Cells.Utility;

string json =
    "[{\"Name\":\"Ada\",\"Quantity\":2}," +
    "{\"Name\":\"Linus\",\"Quantity\":3}]";

Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
JsonLayoutOptions options = new JsonLayoutOptions
{
    ArrayAsTable = true,
    ConvertNumericOrDate = true
};

JsonUtility.ImportData(json, worksheet.Cells, 0, 0, options);

if (worksheet.Cells.MaxDataRow < 1 || worksheet.Cells.MaxDataColumn < 1)
{
    throw new InvalidOperationException("JSON data was not imported.");
}

workbook.Save("json-import.xlsx");
Console.WriteLine("Imported JSON into json-import.xlsx.");

Export pattern:

Range range = worksheet.Cells.CreateRange("A1:B3");
JsonSaveOptions options = new JsonSaveOptions();
string json = JsonUtility.ExportRangeToJson(range, options);

API truths and map

GoalAPI
Import JSON textJsonUtility.ImportData
Configure JSON layoutJsonLayoutOptions
Export a selected rangeJsonUtility.ExportRangeToJson
Configure exportJsonSaveOptions
Select export dataRange
  • Import offsets are zero-based.
  • Verify version-sensitive layout properties before use.
  • Prefer the current ExportRangeToJson(Range, JsonSaveOptions) signature; older option types may be obsolete.
  • JSON import maps data into cells; it is not a schema validator or general serializer.
  • Export only the intended range to prevent leaking hidden or sensitive data.
  • Bound JSON size/depth and resulting worksheet dimensions.

Example contract and validation

Examples must be complete single-file programs with explicit types, inline deterministic JSON by default, one operation, and metadata for title, intent, APIs, input, output, and expected result. Parse JSON output structurally; verify imported headers, rows, types, and cell values. Build and run against the installed package. Catch malformed input with context but never suppress failure or print success.

Security, performance, and anti-patterns

Treat JSON as untrusted. Limit size and nesting, validate destinations, avoid formula injection when imported strings may later be interpreted as formulas, and do not log sensitive payloads. Import once into the intended offset and export the smallest range. Do not invent JsonUtility.Load, encryption, schema validation, streaming, pretty-print, encoding, or CSV properties without API verification.

AI retrieval and FAQ

Use ImportData for JSON text to cells and ExportRangeToJson for cells to JSON. ArrayAsTable is appropriate for arrays of similar records when supported by the installed version. Aspose.Cells is not a replacement for System.Text.Json when the task is generic JSON processing.

Official resources

Definition of done

The example compiles, runs, uses current verified JSON APIs, checks exact imported or exported structure, limits the data scope, and contains no unrelated serializer or integration dependency.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.