Class IAnyImageJsonConverter
Convert image to/from JSON
Inheritance
Inherited Members
Namespace: IronWord.Models
Assembly: IronWord.dll
Syntax
public class IAnyImageJsonConverter : < af9ee0c5 - a8cb - 435 a - 8f c7 - 7f 3f 1 c1a3657 > JsonConverter < IAnyImage >
IAnyImageJsonConverter is the Newtonsoft.Json converter that serializes and deserializes an IAnyImage when IronWord reads or writes its object model as JSON. It is the bridge that lets an image-bearing element survive a round trip through JSON, rather than something application code calls directly.
The converter extends Newtonsoft's generic JsonConverter<IAnyImage> and overrides the two members that type does: WriteJson emits an IAnyImage into a JSON writer, and ReadJson reconstructs one from a JSON reader. Newtonsoft invokes these during serialization, so the usual way to use the converter is to register it on the serializer settings; you rarely call ReadJson or WriteJson yourself. This matters when you persist or transmit a document fragment that carries an image and need the image content preserved across the conversion.
JsonConvert.SerializeObject(element, new IAnyImageJsonConverter());The add image how-to covers placing images, and the object tree example shows the model these images sit within.
Constructors
IAnyImageJsonConverter()
Declaration
public IAnyImageJsonConverter()
Methods
ReadJson(<af9ee0c5-a8cb-435a-8fc7-7f3f1c1a3657>JsonReader, Type, IAnyImage, Boolean, <af9ee0c5-a8cb-435a-8fc7-7f3f1c1a3657>JsonSerializer)
Declaration
public override IAnyImage ReadJson( < af9ee0c5 - a8cb - 435 a - 8f c7 - 7f 3f 1 c1a3657 > JsonReader reader, Type objectType, IAnyImage existingValue, bool hasExistingValue, < af9ee0c5 - a8cb - 435 a - 8f c7 - 7f 3f 1 c1a3657 > JsonSerializer serializer)
Parameters
| Type | Name | Description |
|---|---|---|
| <af9ee0c5-a8cb-435a-8fc7-7f3f1c1a3657>JsonReader | reader | |
| System.Type | objectType | |
| IronSoftware.Abstractions.IAnyImage | existingValue | |
| System.Boolean | hasExistingValue | |
| <af9ee0c5-a8cb-435a-8fc7-7f3f1c1a3657>JsonSerializer | serializer |
Returns
| Type | Description |
|---|---|
| IronSoftware.Abstractions.IAnyImage |
Overrides
WriteJson(<af9ee0c5-a8cb-435a-8fc7-7f3f1c1a3657>JsonWriter, IAnyImage, <af9ee0c5-a8cb-435a-8fc7-7f3f1c1a3657>JsonSerializer)
Declaration
public override void WriteJson( < af9ee0c5 - a8cb - 435 a - 8f c7 - 7f 3f 1 c1a3657 > JsonWriter writer, IAnyImage value, < af9ee0c5 - a8cb - 435 a - 8f c7 - 7f 3f 1 c1a3657 > JsonSerializer serializer)
Parameters
| Type | Name | Description |
|---|---|---|
| <af9ee0c5-a8cb-435a-8fc7-7f3f1c1a3657>JsonWriter | writer | |
| IronSoftware.Abstractions.IAnyImage | value | |
| <af9ee0c5-a8cb-435a-8fc7-7f3f1c1a3657>JsonSerializer | serializer |