16 lines
428 B
C#
16 lines
428 B
C#
using System;
|
|
|
|
namespace ln.json.mapping
|
|
{
|
|
public class JSONGuidMapping : JSONMapping
|
|
{
|
|
public JSONGuidMapping()
|
|
:base(typeof(Guid))
|
|
{
|
|
}
|
|
|
|
public override object FromJson(JSONMapper mapper, JSONValue json) => Guid.Parse(((JSONString)json).Value);
|
|
public override JSONValue ToJson(JSONMapper mapper, object value) => new JSONString(((Guid)value).ToString());
|
|
}
|
|
}
|