# hard-rox/json-linq architecture

> Architecture diagram of the GitHub repository hard-rox/json-linq, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hard-rox/json-linq
- Repository: https://github.com/hard-rox/json-linq

## Overview

JsonLinq is a .NET library for loading JSON and querying it through a fluent, LINQ-like API. The main workflow is to parse JSON text or a file into a query, select a scope, apply filters, ordering, grouping, projection, and aggregation, then retrieve results. Path resolution supports navigation, while extension methods provide typed field access in predicates. The sampled implementation shows these responsibilities, but does not expose every API method body; the broader query capabilities are documented in the README.

Main entry points: [`src/JsonLinq/JsonQuery.cs`](https://github.com/hard-rox/json-linq/blob/main/src/JsonLinq/JsonQuery.cs) (Fluent query), [`src/JsonLinq/Utilities/PathResolver.cs`](https://github.com/hard-rox/json-linq/blob/main/src/JsonLinq/Utilities/PathResolver.cs) (Path resolver), [`src/JsonLinq/Utilities/JsonParser.cs`](https://github.com/hard-rox/json-linq/blob/main/src/JsonLinq/Utilities/JsonParser.cs) (JSON parser), [`src/JsonLinq/Exceptions/InvalidPathException.cs`](https://github.com/hard-rox/json-linq/blob/main/src/JsonLinq/Exceptions/InvalidPathException.cs) (Invalid path)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_query["Query API"]
  node_jsonquery["Fluent query<br/>[JsonQuery.cs]"]
  node_extensions["Value accessors"]
end

subgraph group_support["Parsing and navigation"]
  node_parser["JSON parser<br/>[JsonParser.cs]"]
  node_paths["Path resolver<br/>[PathResolver.cs]"]
  node_valuehelper["Sort values<br/>[JsonValueHelper.cs]"]
end

subgraph group_errors["Query errors"]
  node_queryerror["Query exception"]
  node_patherror["Invalid path"]
end

node_user(("Library user"))

node_user -->|"starts query"| node_jsonquery
node_jsonquery -->|"parses input"| node_parser
node_user -->|"chains operations"| node_jsonquery
node_jsonquery -->|"resolves paths"| node_paths
node_jsonquery -->|"compares sort values"| node_valuehelper
node_extensions -->|"resolves nested values"| node_paths
node_parser -->|"throws on invalid JSON"| node_queryerror
node_paths -->|"throws for bad index"| node_patherror
node_patherror -->|"derives from"| node_queryerror

click node_jsonquery "https://github.com/hard-rox/json-linq/blob/main/src/JsonLinq/JsonQuery.cs"
click node_extensions "https://github.com/hard-rox/json-linq/blob/main/src/JsonLinq/JsonNodeExtensions.cs"
click node_parser "https://github.com/hard-rox/json-linq/blob/main/src/JsonLinq/Utilities/JsonParser.cs"
click node_paths "https://github.com/hard-rox/json-linq/blob/main/src/JsonLinq/Utilities/PathResolver.cs"
click node_valuehelper "https://github.com/hard-rox/json-linq/blob/main/src/JsonLinq/Utilities/JsonValueHelper.cs"
click node_queryerror "https://github.com/hard-rox/json-linq/blob/main/src/JsonLinq/Exceptions/JsonQueryException.cs"
click node_patherror "https://github.com/hard-rox/json-linq/blob/main/src/JsonLinq/Exceptions/InvalidPathException.cs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_jsonquery,node_extensions,node_user toneBlue
class node_parser,node_paths,node_valuehelper toneAmber
class node_queryerror,node_patherror toneMint
```

## Components

### Query API

- [Fluent query](https://github.com/hard-rox/json-linq/blob/main/src/JsonLinq/JsonQuery.cs): `src/JsonLinq/JsonQuery.cs`
- [Value accessors](https://github.com/hard-rox/json-linq/blob/main/src/JsonLinq/JsonNodeExtensions.cs): `src/JsonLinq/JsonNodeExtensions.cs`

### Parsing and navigation

- [JSON parser](https://github.com/hard-rox/json-linq/blob/main/src/JsonLinq/Utilities/JsonParser.cs): `src/JsonLinq/Utilities/JsonParser.cs`
- [Path resolver](https://github.com/hard-rox/json-linq/blob/main/src/JsonLinq/Utilities/PathResolver.cs): `src/JsonLinq/Utilities/PathResolver.cs`
- [Sort values](https://github.com/hard-rox/json-linq/blob/main/src/JsonLinq/Utilities/JsonValueHelper.cs): `src/JsonLinq/Utilities/JsonValueHelper.cs`

### Query errors

- [Query exception](https://github.com/hard-rox/json-linq/blob/main/src/JsonLinq/Exceptions/JsonQueryException.cs): `src/JsonLinq/Exceptions/JsonQueryException.cs`
- [Invalid path](https://github.com/hard-rox/json-linq/blob/main/src/JsonLinq/Exceptions/InvalidPathException.cs): `src/JsonLinq/Exceptions/InvalidPathException.cs`

### Other components

- **Library user**

## Connections

- Library user → Fluent query: starts query (evidence: `README.md`)
- Fluent query → JSON parser: parses input (evidence: `src/JsonLinq/JsonQuery.cs`)
- Library user → Fluent query: chains operations (evidence: `README.md`)
- Fluent query → Path resolver: resolves paths (evidence: `src/JsonLinq/JsonQuery.cs`)
- Fluent query → Sort values: compares sort values (evidence: `src/JsonLinq/JsonQuery.cs`)
- Value accessors → Path resolver: resolves nested values (evidence: `src/JsonLinq/JsonNodeExtensions.cs`)
- JSON parser → Query exception: throws on invalid JSON (evidence: `src/JsonLinq/Utilities/JsonParser.cs`)
- Path resolver → Invalid path: throws for bad index (evidence: `src/JsonLinq/Utilities/PathResolver.cs`)
- Invalid path → Query exception: derives from (evidence: `src/JsonLinq/Exceptions/InvalidPathException.cs`)
