Class JsonStreamConverter
This utility class is designed to make JSON System.IO.Stream related conversions easier to work with.
Inheritance
Namespace: Cuemon.IO
Assembly: Cuemon.Xml.dll
Syntax
public static class JsonStreamConverter
Methods
| Improve this DocFromXmlStream(Stream)
Returns a UTF-8 encoded JSON representation of the specified XML stream and whose value is equivalent to the specified XML stream.
Declaration
public static Stream FromXmlStream(Stream value)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | value | The XML to convert to a JSON representation. |
Returns
Type | Description |
---|---|
System.IO.Stream | A UTF-8 encoded JSON representation of the specified |
Remarks
The JSON representation is in compliance with RFC 4627. Take note, that all string values is escaped using Escape(String). This is by design and to help ensure compatibility with a wide range of data.
FromXmlStream(Stream, Encoding)
Returns a JSON representation of the specified XML stream and whose value is equivalent to the specified XML stream.
Declaration
public static Stream FromXmlStream(Stream value, Encoding encoding)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | value | The XML to convert to a JSON representation. |
System.Text.Encoding | encoding | The text encoding to use. |
Returns
Type | Description |
---|---|
System.IO.Stream | A JSON representation of the specified |
Remarks
The JSON representation is in compliance with RFC 4627. Take note, that all string values is escaped using Escape(String). This is by design and to help ensure compatibility with a wide range of data.
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException | This exception is thrown when |
System.ArgumentNullException | This exception is thrown should either of |