# TopologyIconPackJson

Reads and writes dependency-free JSON manifests for topology icon packs.

 Class  

`ChartForgeX.Topology`

**Namespace**

`ChartForgeX.Topology`

**Assembly**

`ChartForgeX`

**Source**

[TopologyIconPackJson.cs:27](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Topology/TopologyIconPackJson.cs#L27)

**Modifiers**

static

Reads and writes dependency-free JSON manifests for topology icon packs.

## Inheritance

- object
- TopologyIconPackJson

## Guides & Samples

Authored walkthroughs and practical samples linked to this API.

- [Topology icon packs](/docs/topology-icon-packs/) Guide 
  
  Portable stencil manifests, SVG imports and validation.

 Filter members   

    Show inherited   

 

## Methods

 AddJsonPack 2 overloads 

 `public static TopologyIconCatalog AddJsonPack(TopologyIconCatalog catalog, string json)` [#](#method-addjsonpack-chartforgex-topology-topologyiconcatalog-string) 

[TopologyIconPackJson.cs:27](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Topology/TopologyIconPackJson.cs#L27)

Adds a JSON manifest icon pack to the catalog.

Parameters

**catalog ChartForgeX.Topology.TopologyIconCatalog required**

The target catalog.

**json string required**

The JSON manifest.

Returns

 `TopologyIconCatalog` The current catalog. 

 `public static TopologyIconCatalog AddJsonPack(TopologyIconCatalog catalog, TextReader reader)` [#](#method-addjsonpack-chartforgex-topology-topologyiconcatalog-io-textreader) 

[TopologyIconPackJson.cs:38](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Topology/TopologyIconPackJson.cs#L38)

Adds a JSON manifest icon pack read from a text reader to the catalog.

Parameters

**catalog ChartForgeX.Topology.TopologyIconCatalog required**

The target catalog.

**reader System.IO.TextReader required**

The source text reader.

Returns

 `TopologyIconCatalog` The current catalog. 

 `public static TopologyIconCatalog AddJsonPackFile(TopologyIconCatalog catalog, string path)` [#](#method-addjsonpackfile-chartforgex-topology-topologyiconcatalog-string) 

[TopologyIconPackJson.cs:49](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Topology/TopologyIconPackJson.cs#L49)

Adds a JSON manifest icon pack read from a file to the catalog.

Parameters

**catalog ChartForgeX.Topology.TopologyIconCatalog required**

The target catalog.

**path string required**

The manifest file path.

Returns

 `TopologyIconCatalog` The current catalog. 

 `public static TopologyIconCatalog AddJsonPacksFromDirectory(TopologyIconCatalog catalog, string directoryPath, string searchPattern = "*.json", bool recursive = false)` [#](#method-addjsonpacksfromdirectory-chartforgex-topology-topologyiconcatalog-string-string-boolean) 

[TopologyIconPackJson.cs:62](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Topology/TopologyIconPackJson.cs#L62)

Adds all JSON icon-pack manifests from a directory to the catalog in deterministic file-name order.

Parameters

**catalog ChartForgeX.Topology.TopologyIconCatalog required**

The target catalog.

**directoryPath string required**

The source directory path.

**searchPattern string = "*.json" optional**

The file search pattern.

**recursive bool = false optional**

Whether child directories should be searched.

Returns

 `TopologyIconCatalog` The current catalog. 

 FromJson 2 overloads 

 `public static TopologyIconPack FromJson(string json)` [#](#method-fromjson-string) 

[TopologyIconPackJson.cs:73](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Topology/TopologyIconPackJson.cs#L73)

Creates a topology icon pack from a JSON manifest.

Parameters

**json string required**

The JSON manifest.

Returns

 `TopologyIconPack` The imported topology icon pack. 

 `public static TopologyIconPack FromJson(string json, string? manifestDirectory)` [#](#method-fromjson-string-string) 

[TopologyIconPackJson.cs:84](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Topology/TopologyIconPackJson.cs#L84)

Creates a topology icon pack from a JSON manifest and optionally resolves pack-local sidecar artwork.

Parameters

**json string required**

The JSON manifest.

**manifestDirectory string? required**

The manifest directory used to resolve sidecar artwork paths.

Returns

 `TopologyIconPack` The imported topology icon pack. 

 LoadJsonCatalogFromDirectory 2 overloads 

 `public static TopologyIconCatalogLoadResult LoadJsonCatalogFromDirectory(string directoryPath, string searchPattern = "*.json", bool recursive = false, bool includeBuiltInPacks = true)` [#](#method-loadjsoncatalogfromdirectory-string-string-boolean-boolean) 

[TopologyIconPackJson.cs:202](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Topology/TopologyIconPackJson.cs#L202)

Loads a topology icon catalog from a directory and returns per-file diagnostics.

Parameters

**directoryPath string required**

The source directory path.

**searchPattern string = "*.json" optional**

The file search pattern.

**recursive bool = false optional**

Whether child directories should be searched.

**includeBuiltInPacks bool = true optional**

Whether the returned catalog should start with ChartForgeX built-in packs.

Returns

 `TopologyIconCatalogLoadResult` The loaded catalog plus per-file diagnostics. 

 `public static TopologyIconCatalogLoadResult LoadJsonCatalogFromDirectory(string directoryPath, TopologyIconCatalogLoadOptions? options)` [#](#method-loadjsoncatalogfromdirectory-string-chartforgex-topology-topologyiconcatalogloadoptions) 

[TopologyIconPackJson.cs:216](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Topology/TopologyIconPackJson.cs#L216)

Loads a topology icon catalog from a directory and returns per-file diagnostics.

Parameters

**directoryPath string required**

The source directory path.

**options ChartForgeX.Topology.TopologyIconCatalogLoadOptions? required**

The load options.

Returns

 `TopologyIconCatalogLoadResult` The loaded catalog plus per-file diagnostics. 

 LoadJsonManifest 3 overloads 

 `public static TopologyIconPack LoadJsonManifest(string path)` [#](#method-loadjsonmanifest-string) 

[TopologyIconPackJson.cs:127](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Topology/TopologyIconPackJson.cs#L127)

Loads a topology icon pack from a JSON manifest file.

Parameters

**path string required**

The manifest file path.

Returns

 `TopologyIconPack` The imported topology icon pack. 

 `public static TopologyIconPack LoadJsonManifest(TextReader reader)` [#](#method-loadjsonmanifest-io-textreader) 

[TopologyIconPackJson.cs:144](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Topology/TopologyIconPackJson.cs#L144)

Loads a topology icon pack from a JSON manifest text reader.

Parameters

**reader System.IO.TextReader required**

The source text reader.

Returns

 `TopologyIconPack` The imported topology icon pack. 

 `public static TopologyIconPack LoadJsonManifest(TextReader reader, string manifestDirectory)` [#](#method-loadjsonmanifest-io-textreader-string) 

[TopologyIconPackJson.cs:155](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Topology/TopologyIconPackJson.cs#L155)

Loads a topology icon pack from a JSON manifest text reader and resolves pack-local sidecar artwork.

Parameters

**reader System.IO.TextReader required**

The source text reader.

**manifestDirectory string required**

The manifest directory used to resolve sidecar artwork paths.

Returns

 `TopologyIconPack` The imported topology icon pack. 

 `public static IReadOnlyList<TopologyIconPackLoadResult> LoadJsonManifestResultsFromDirectory(string directoryPath, string searchPattern = "*.json", bool recursive = false)` [#](#method-loadjsonmanifestresultsfromdirectory-string-string-boolean) 

[TopologyIconPackJson.cs:181](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Topology/TopologyIconPackJson.cs#L181)

Loads all JSON icon-pack manifests from a directory and reports per-file success or failure.

Parameters

**directoryPath string required**

The source directory path.

**searchPattern string = "*.json" optional**

The file search pattern.

**recursive bool = false optional**

Whether child directories should be searched.

Returns

 `IReadOnlyList<TopologyIconPackLoadResult>` Per-file load results in deterministic file-name order. 

 `public static IReadOnlyList<TopologyIconPack> LoadJsonManifestsFromDirectory(string directoryPath, string searchPattern = "*.json", bool recursive = false)` [#](#method-loadjsonmanifestsfromdirectory-string-string-boolean) 

[TopologyIconPackJson.cs:168](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Topology/TopologyIconPackJson.cs#L168)

Loads all JSON icon-pack manifests from a directory in deterministic file-name order.

Parameters

**directoryPath string required**

The source directory path.

**searchPattern string = "*.json" optional**

The file search pattern.

**recursive bool = false optional**

Whether child directories should be searched.

Returns

 `IReadOnlyList<TopologyIconPack>` The imported topology icon packs. 

 `public static void SaveJsonManifest(TopologyIconPack pack, string path, bool indented = true)` [#](#method-savejsonmanifest-chartforgex-topology-topologyiconpack-string-boolean) 

[TopologyIconPackJson.cs:279](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Topology/TopologyIconPackJson.cs#L279)

Saves a topology icon pack to a JSON manifest file.

Parameters

**pack ChartForgeX.Topology.TopologyIconPack required**

The icon pack.

**path string required**

The target manifest file path.

**indented bool = true optional**

Whether the manifest should be indented.

 `public static string ToJsonManifest(TopologyIconPack pack, bool indented = true)` [#](#method-tojsonmanifest-chartforgex-topology-topologyiconpack-boolean) 

[TopologyIconPackJson.cs:238](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Topology/TopologyIconPackJson.cs#L238)

Serializes a topology icon pack as a deterministic JSON manifest.

Parameters

**pack ChartForgeX.Topology.TopologyIconPack required**

The icon pack.

**indented bool = true optional**

Whether the manifest should be indented.

Returns

 `string` The JSON manifest. 

 `public static void WriteJsonManifest(TopologyIconPack pack, TextWriter writer, bool indented = true)` [#](#method-writejsonmanifest-chartforgex-topology-topologyiconpack-io-textwriter-boolean) 

[TopologyIconPackJson.cs:291](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Topology/TopologyIconPackJson.cs#L291)

Writes a topology icon pack JSON manifest to a text writer.

Parameters

**pack ChartForgeX.Topology.TopologyIconPack required**

The icon pack.

**writer System.IO.TextWriter required**

The target text writer.

**indented bool = true optional**

Whether the manifest should be indented.

## Inherited Methods

 `public virtual bool Equals(object? obj)` [#](#method-equals-object) 

Inherited from object

Parameters

**obj object? required**

Returns

 `bool` 

 `public virtual int GetHashCode()` [#](#method-gethashcode) 

Inherited from object

Returns

 `int` 

 `public Type GetType()` [#](#method-gettype) 

Inherited from object

Returns

 `Type` 

 `public virtual string? ToString()` [#](#method-tostring) 

Inherited from object

Returns

 `string?` 

## Fields

 `public const string Schema` [#](#field-schema) 

[TopologyIconPackJson.cs:16](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Topology/TopologyIconPackJson.cs#L16)

Gets the manifest schema identifier.

Value: `chartforgex.topology.iconPack`

<!-- PowerForge markdown artifact sha256:4D3B4478F3D92ED2FABA00D4E10F0E62E9AB873E58AF8098143C797DDF2AA5A3 -->
