GenerateJson Class
Converts objects stored in metadata or elsewhere to JSON.
Namespace
Statiq.Core
Interfaces
Base Types
graph BT Type-->Base0["ParallelSyncConfigModule<object>"] Base0-->Base1["ParallelConfigModule<object>"] Base1-->Base2["Module"] click Base2 "/api/Statiq.Common/Module" Base2-->Base3["object"] Type-.->Interface0["IModule"] click Interface0 "/api/Statiq.Common/IModule" Type-.->Interface1["IParallelModule"] click Interface1 "/api/Statiq.Common/IParallelModule" Type["GenerateJson"] class Type type-node

Syntax

public class GenerateJson : ParallelSyncConfigModule<object>, IModule, IParallelModule

Remarks

Generates JSON for a specified object (which can come from document metadata or elsewhere) and stores it as new content for each input document or in each document's metadata.

Constructors

Name Summary
GenerateJson(Config<IEnumerable<string>>, string) Allows you to specify metadata keys for each input document that should be serialized as properties in a JSON object.
GenerateJson(Config<object>, string) The object returned by the specified delegate is converted to JSON, which then either replaces the content of each input document or is stored in the specified metadata key.
GenerateJson(Config<string>, string) The object stored in metadata at the specified key is converted to JSON, which then either replaces the content of each input document or is stored in the specified metadata key.

Methods

Name Return Value Summary
AfterExecution(IExecutionContext, ExecutionOutputs) void
Called after each module execution.
Inherited from Module
AfterExecutionAsync(IExecutionContext, ExecutionOutputs) Task
Called after each module execution.
Inherited from Module
BeforeExecution(IExecutionContext) void
Called before each module execution.
Inherited from Module
BeforeExecutionAsync(IExecutionContext) Task
Called before each module execution.
Inherited from Module
ExecuteAsync(IExecutionContext) Task<IEnumerable<IDocument>>
This should not be called directly, instead call IExecutionContext.Execute() if you need to execute a module from within another module.
Inherited from Module
ExecuteConfig(IDocument, IExecutionContext, object) IEnumerable<IDocument>
Finally(IExecutionContext) void
Called after each module execution, even if an exception is thrown during execution.
Inherited from Module
FinallyAsync(IExecutionContext) Task
Called after each module execution, even if an exception is thrown during execution.
Inherited from Module
WithCamelCase(bool) GenerateJson
Specifies whether the generated JSON should use a camel case naming strategy for property names. The default behavior is not to generate camel case property names.
WithIndenting(bool) GenerateJson
Specifies whether the generated JSON should be indented.
WithSettings(Action<JsonSerializerOptions>) GenerateJson
Allows changing the JSON serializer options.

Extension Methods