GenerateJson Class

Summary

Converts objects stored in metadata or elsewhere to JSON.
Assembly
Wyam.Json.dll
Namespace
Wyam.Json
Interfaces
Base Types
  • Object
graph BT Type-->Base0["Object"] Type-.->Interface0["IModule"] click Interface0 "/api/Wyam.Common.Modules/IModule" Type["GenerateJson"] class Type type-node

Syntax

public class GenerateJson : IModule

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(ContextConfig, 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(DocumentConfig, 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(IEnumerable<string>, string) Allows you to specify metadata keys for each input document that should be serialized as properties in a JSON object.
GenerateJson(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 Value Summary
Execute(IReadOnlyList<IDocument>, IExecutionContext) IEnumerable<IDocument>
This should not be called directly, instead call IExecutionContext.Execute() if you need to execute a module from within another 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<JsonSerializerSettings>) GenerateJson
Allows changing the JSON serializer settings.
GitHub