agentic-net-examples / working-with-json
AGENTS.md1 starsChanged 2 months 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…
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.
Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository32 other files it gives its agents.
- Aspose.Cells for .NET Product AgentAGENTS.md
- calculate-formulas/AGENTS.mdAGENTS.md
- cells-data/AGENTS.mdAGENTS.md
- comments-and-notes/AGENTS.mdAGENTS.md
- conversion/AGENTS.mdAGENTS.md
- document-properties/AGENTS.mdAGENTS.md
- encryption-and-protection/AGENTS.mdAGENTS.md
- format-cells/AGENTS.mdAGENTS.md
- globalization-and-localization/AGENTS.mdAGENTS.md
- macro-project/AGENTS.mdAGENTS.md
- manage-formulas/AGENTS.mdAGENTS.md
- manage-workbook/AGENTS.mdAGENTS.md
- managing-ranges/AGENTS.mdAGENTS.md
- open-workbook/AGENTS.mdAGENTS.md
- pivot-table/AGENTS.mdAGENTS.md
- queries-and-connections/AGENTS.mdAGENTS.md
- rows-and-columns/AGENTS.mdAGENTS.md
- save-workbook/AGENTS.mdAGENTS.md
- slicer/AGENTS.mdAGENTS.md
- smart-markers/AGENTS.mdAGENTS.md
- sparkline/AGENTS.mdAGENTS.md
- timeline/AGENTS.mdAGENTS.md
- workbook-merger/AGENTS.mdAGENTS.md
- working-with-charts/AGENTS.mdAGENTS.md
- working-with-html/AGENTS.mdAGENTS.md
- working-with-images/AGENTS.mdAGENTS.md
- working-with-pdf/AGENTS.mdAGENTS.md
- working-with-shapes/AGENTS.mdAGENTS.md
- working-with-tables/AGENTS.mdAGENTS.md
- working-with-worksheets/AGENTS.mdAGENTS.md
- xml-maps/AGENTS.mdAGENTS.md
- llms.txtllms.txt
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
- Very specific: line 22
Create focused C# examples for tabular JSON-to-cell import and worksheet-range-to-JSON export.
- Distinctive: line 76
Import offsets are zero-based.
- Distinctive: line 77
Verify version-sensitive layout properties before use.
- Very specific: line 78
Prefer the current ExportRangeToJson(Range, JsonSaveOptions) signature.
- Very specific: line 93
Use ImportData for JSON text to cells and ExportRangeToJson for cells to JSON.
≈ “Common” is an estimate: at least 1 in 5 of the 16,595 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.
Files
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
| Goal | API |
| Import JSON text | JsonUtility.ImportData |
| Configure JSON layout | JsonLayoutOptions |
| Export a selected range | JsonUtility.ExportRangeToJson |
| Configure export | JsonSaveOptions |
| Select export data | Range |
- 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.
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
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.

