Skip to content

Instantly share code, notes, and snippets.

@rsafier
Last active February 14, 2018 19:51
Show Gist options
  • Save rsafier/8849368b21d4fe73750bd9fccb151def to your computer and use it in GitHub Desktop.
Save rsafier/8849368b21d4fe73750bd9fccb151def to your computer and use it in GitHub Desktop.
OddDecode
using System.Linq;
using ServiceStack;
using ServiceStack.Text;
using System.Net;
using System;
using System.Collections.Generic;
using System.Linq;
private class FowardAirFSCResponse
{
public FAFSCs FSCResponse { get; set; }
}
private class FAFSCs
{
public List<FAFSC> FSCs { get; set; } = new List<FAFSC>();
}
private class FAFSC
{
public DateTime IssueDate { get; set; }
public decimal MaxPrice { get; set; }
public DateTime EndDate { get; set; }
public decimal EUVSurcharge { get; set; }
public decimal MinPrice { get; set; }
public decimal SystemSurcharge { get; set; }
public decimal DieselPrice { get; set; }
public DateTime EffectiveDate { get; set; }
}
var pureJson = "{\"FSCResponse\":{\"FSCs\":[{\"IssueDate\":\"02/12/2018\",\"MaxPrice\":\"3.10\",\"EndDate\":\"02/25/2018\",\"EUVSurcharge\":\"33.3\",\"EffectiveDate\":\"02/19/2018\",\"DieselPrice\":\"3.06\",\"SystemSurcharge\":\"19.5\",\"MinPrice\":\"3.05\"}, {\"IssueDate\":\"02/05/2018\",\"MaxPrice\":\"3.10\",\"EndDate\":\"02/18/2018\",\"EUVSurcharge\":\"33.3\",\"EffectiveDate\":\"02/12/2018\",\"DieselPrice\":\"3.08\",\"SystemSurcharge\":\"19.5\",\"MinPrice\":\"3.05\"}]}}";
var jsonResponseDecoded = pureJson.FromJson<FowardAirFSCResponse>();
jsonResponseDecoded.PrintDump();
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="ServiceStack.Text" version="5.0.2" targetFramework="net45" />
<package id="ServiceStack.Client" version="5.0.2" targetFramework="net45" />
<package id="ServiceStack.Interfaces" version="5.0.2" targetFramework="net45" />
</packages>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment