I'm attempting to parse a rather convoluted/unnecessarily complicated JSON output using newtonsoft in C# however for some reason my parser always returns null and doesn't elaborate as to exactly why this is the case.
An example of a JSON file I'm trying to parse:
{
"response": {
"success": 1,
"current_time": 1362339098,
"prices": {
"35": {
"11": {
"0": {
"current": {
"currency": "keys",
"value": 39,
"value_high": 41,
"date": 1357515306
},
"previous": {
"currency": "keys",
"value": 37,
"value_high": 39
}
}
},
"3": {
"0": {
"current": {
"currency": "metal",
"value": 0.33,
"value_high": 0.66
}
}
}
},
"5002": {
"6": {
"0": {
"current": {
"currency": "usd",
"value": 0.39,
"value_high": 0.42,
"date": 1358090106
}
}
}
},
"5022": {
"6": {
"1": {
"current": {
"currency": "metal",
"value": 1.33,
"value_high": 1.55,
"date": 1357515175
}
}
}
}
}
}
}
And the C# parser I'm using. I run the getCurrentPrices() to return a PriceParser object but instead the object returned is always null.
using System;
using System.Collections.Generic;
using System.IO;
using Newtonsoft.Json;
using System.Diagnostics;
namespace SteamBot
{
class PriceParser
{
//Methods
public PriceParser updatePrices()
{
var json = File.ReadAllText("test.json");
ParserResult result = JsonConvert.DeserializeObject<ParserResult>(json);
return result.result;
}
public Data currentPrices { get; set; }
//DATA
public class Data
{
public Response Response { get; set; }
}
public class Response
{
public string success { get; set; }
public string current_time {get; set;}
public List<Price> prices { get; set;}
}
public class Price
{
public int defindex { get; set; }
public int quality { get; set; }
public Current current { get; set; }
public Previous previous { get; set; }
}
public class Current
{
public string currency { get; set; }
public float value { get; set; }
public float value_high { get; set; }
public int date { get; set; }
}
public class Previous
{
public string currency { get; set; }
public float value { get; set; }
public float value_high { get; set; }
public int date { get; set; }
}
protected class ParserResult
{
public PriceParser result { get; set; }
}
}
}
I'm probably just missing something stupid but for the life of me I can't figure out what, anyone with more JSON wrangling experience know what's going on here?