-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bbd3ae8
commit ce84ebb
Showing
1 changed file
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Results.Json | ||
|
||
Package contains code to help serialize and deserialize Result objects to and from JSON. | ||
`JsonConverterFactoryForResultOfT` is a `JsonConverterFactory` that can create `JsonConverter` objects for any `Result<T>` object. | ||
Remember, a Result representing one or more Errors contains a list of objects implementing the `IError` interface. | ||
The actual type of an Error object is not included when serialized. This means, that when deserializing that Error again, it can't be deserialized to its original type. | ||
Instead, the Error object is deserialized to a generic `DeserializedError` object. | ||
|
||
A serialized _Successful_ `Result<T>` will look like this: | ||
```json | ||
{ | ||
"Success": true, | ||
"Value": "Some value" | ||
} | ||
``` | ||
A serialized _Successful_ `Result<Unit>` will look like this: | ||
```json | ||
{ | ||
"Success": true | ||
} | ||
``` | ||
A serialized _Error_ `Result<T>` or `Result<Unit>` will look like this: | ||
```json | ||
{ | ||
"Success": false, | ||
"Errors": [ | ||
{ | ||
"Type": "MyError", | ||
"Message": "Some error message" | ||
"Data": { | ||
"Key": "value", | ||
} | ||
} | ||
] | ||
} | ||
``` |