Show / Hide Table of Contents

    Class JsonTransformComponent

    Implements a message pipeline component that transforms intercepted message from XML to JSON format and vise-versa.

    Inheritance
    Object
    MessagePipelineComponentBase
    JsonTransformComponent
    Implements
    IValidator
    IEquatable<MessagePipelineComponentBase>
    IExtensibleDataObject
    Inherited Members
    MessagePipelineComponentBase.Validate(MessagePipelinePositions)
    MessagePipelineComponentBase.ErrorMessage
    MessagePipelineComponentBase.ExtensionData
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetType()
    Object.MemberwiseClone()
    Namespace: Nevatech.Vsb.Repository.Processing
    Assembly: Nevatech.Vsb.Repository.dll
    Syntax
    public sealed class JsonTransformComponent : MessagePipelineComponentBase, IValidator, IEquatable<MessagePipelineComponentBase>, IExtensibleDataObject

    Constructors

    JsonTransformComponent()

    Declaration
    public JsonTransformComponent()

    Fields

    ElementName

    Name of the root element when object is serialized to XML.

    Declaration
    public const string ElementName = "TRANSFORM-JSON"
    Field Value
    Type Description
    String

    Properties

    AllowedPositions

    Gets the message processing pipeline position(s) supported by the component: inbound request or inbound response.

    Declaration
    public override MessagePipelinePositions AllowedPositions { get; }
    Property Value
    Type Description
    MessagePipelinePositions
    Overrides
    MessagePipelineComponentBase.AllowedPositions

    AppendRoot

    Gets or sets the flag indicating that root element(s) must be added to deserialized XML. Setting this flag to True is highly recommended to increase conversion reliability and to extend variety of the supported JSON messages.

    Declaration
    public bool AppendRoot { get; set; }
    Property Value
    Type Description
    Boolean

    ConversionType

    Gets or sets the message conversion type: XML to JSON, JSON to XML, or Auto.

    Declaration
    public MessageConversionType ConversionType { get; set; }
    Property Value
    Type Description
    MessageConversionType

    CreateJsonArrays

    Gets or sets the flag indicating that all but empty XML elements must be converted to arrays during XML-to-JSON transformation. This allows for a consistent (insensitive to the number of elements) JSON representation of XML collections.

    Declaration
    public bool CreateJsonArrays { get; set; }
    Property Value
    Type Description
    Boolean

    JsonpFunctionName

    Gets or sets the default name of the JSONP function to be used if query parameter defined in JsonpParameterName property is not passed. If JsonpParameterName property is not set then value assigned to this property is used to name JSONP function. Setting both JsonpFunctionName and JsonpParameterName to Null disables JSONP transformation.

    Declaration
    public string JsonpFunctionName { get; set; }
    Property Value
    Type Description
    String

    JsonpParameterName

    Gets or sets the query parameter name to be used for retrieving JSONP function name. If parameter is not passed and JsonpFunctionName is not set then JSONP transformation is not performed. Setting both JsonpFunctionName and JsonpParameterName to Null disables JSONP transformation.

    Declaration
    public string JsonpParameterName { get; set; }
    Property Value
    Type Description
    String

    OmitJsonRootObject

    Gets or sets the flag indicating the JSON root object shall not be written when deserialized from XML. If set to True the XML root element will be omitted, so the XML like "<root><fieldA>1</fieldA><fieldB>2</fieldB></root>" will be converted to JSON like "{'fieldA':'1', 'fieldB':'2'}" instead of "{'root': {'fieldA':'1', 'fieldB':'2'}}".

    Declaration
    public bool OmitJsonRootObject { get; set; }
    Property Value
    Type Description
    Boolean

    PreserveXmlNamespaces

    Gets or sets the flag indicating that XML namespace declarations and prefixes must be kept in JSON during XML-to-JSON transformation, so that resulting JSON could be converted back to the original XML. By default (or if it is set to False) all namespaces will be removed to do not clutter JSON string.

    Declaration
    public bool PreserveXmlNamespaces { get; set; }
    Property Value
    Type Description
    Boolean

    Methods

    Equals(MessagePipelineComponentBase)

    Determines whether the specified object is equal to the current object.

    Declaration
    public override bool Equals(MessagePipelineComponentBase other)
    Parameters
    Type Name Description
    MessagePipelineComponentBase other

    The object to compare with the current object.

    Returns
    Type Description
    Boolean

    True if the specified object is equal to the current object; otherwise, false.

    Overrides
    MessagePipelineComponentBase.Equals(MessagePipelineComponentBase)

    Equals(Object)

    Determines whether the specified object is equal to the current object.

    Declaration
    public override bool Equals(object obj)
    Parameters
    Type Name Description
    Object obj

    The object to compare with the current object.

    Returns
    Type Description
    Boolean

    True if the specified object is equal to the current object; otherwise, false.

    Overrides
    MessagePipelineComponentBase.Equals(Object)

    GetHashCode()

    Returns hash code for the value of this instance.

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    Int32

    Hash code for the value of this instance.

    Overrides
    MessagePipelineComponentBase.GetHashCode()

    ProcessMessage(MessagePipelineContext)

    Inspects the message and transforms its content from XML to JSON or vice-versa.

    Declaration
    public override MessagePipelineResult ProcessMessage(MessagePipelineContext context)
    Parameters
    Type Name Description
    MessagePipelineContext context

    Provides the message processing context.

    Returns
    Type Description
    MessagePipelineResult

    Value indicating if message should continue on its way to the recipient or must be stopped and returned to the sender.

    Overrides
    MessagePipelineComponentBase.ProcessMessage(MessagePipelineContext)

    ToString()

    Returns string representation of the object.

    Declaration
    public override string ToString()
    Returns
    Type Description
    String

    String representing the object's content.

    Overrides
    Object.ToString()

    Validate()

    Evaluates the state of the object.

    Declaration
    public override bool Validate()
    Returns
    Type Description
    Boolean

    True if state is valid; otherwise, false.

    Overrides
    MessagePipelineComponentBase.Validate()

    Implements

    IValidator
    System.IEquatable<T>
    System.Runtime.Serialization.IExtensibleDataObject
    Back to top Nevatech Sentinet 6.5 Online Documentation