Skip to content

Instantly share code, notes, and snippets.

@mythz mythz/main.cs
Last active Oct 18, 2018

Embed
What would you like to do?
test json deserialization
using System;
using System.Linq;
using System.Collections.Generic;
using ServiceStack;
using ServiceStack.Text;
var json = "{\"Confirmations\":[{\"ChangeId\":126552616,\"Confirmed\":true}]}";
[Route("/confirmations", "PUT")]
public class PutConfirmed : IReturn<PutConfirmedResponse>
{
#region Public Properties
public List<Confirmation> Confirmations { get; set; }
#endregion Public Properties
}
public class Confirmation
{
#region Public Constructors
public Confirmation()
{
ChangeId = 0;
Confirmed = false;
}
#endregion Public Constructors
#region Public Properties
public int ChangeId { get; set; }
public bool Confirmed { get; set; }
#endregion Public Properties
}
public class PutConfirmedResponse
{
#region Public Properties
public bool IsSucceed { get; set; }
public ResponseStatus ResponseStatus { get; set; }
#endregion Public Properties
}
var dto = json.FromJson<PutConfirmed>();
dto.PrintDump();
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="ServiceStack.Text" version="5.4.0" targetFramework="net45" />
<package id="ServiceStack.Client" version="5.4.0" targetFramework="net45" />
<package id="ServiceStack.Interfaces" version="5.4.0" targetFramework="net45" />
</packages>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.