Bilnord
Bilnord
CC#
Created by Bilnord on 1/30/2023 in #help
Newtonsoft .NET Deserialization
Thanks for yours help Fyren and neSHa gonna close the thread.
37 replies
CC#
Created by Bilnord on 1/30/2023 in #help
Newtonsoft .NET Deserialization
I know but tried to look for a way to deserialize it without making a lot of classes, thats not my created json I'm just working with it but gonna drop it and make a own one
37 replies
CC#
Created by Bilnord on 1/30/2023 in #help
Newtonsoft .NET Deserialization
Yes
37 replies
CC#
Created by Bilnord on 1/30/2023 in #help
Newtonsoft .NET Deserialization
"items_list": {
{
"name": "&#39Blueberries&#39 Buckshot | NSWC SEAL",
"marketable": 1,
"tradable": 1,
"classid": "4114517977",
"icon_url": "----",
"icon_url_large": null,
"type": null,
"rarity": "Exceptional",
"rarity_color": "8847ff",
"price": {
"7_days": {
"average": 3.19,
"median": 3.18,
"sold": "289",
"standard_deviation": "12.46",
"lowest_price": 0.99,
"highest_price": 3.61
},
"30_days": {
"average": 2.84,
"median": 2.8,
"sold": "2835",
"standard_deviation": "11.32",
"lowest_price": 0.99,
"highest_price": 3.61
},
"all_time": {
"average": 1.41,
"median": 2.38,
"sold": "157819",
"standard_deviation": "51.15",
"lowest_price": 0.83,
"highest_price": 3.61
}
},
"first_sale_date": "1607036400"
}
}
"items_list": {
{
"name": "&#39Blueberries&#39 Buckshot | NSWC SEAL",
"marketable": 1,
"tradable": 1,
"classid": "4114517977",
"icon_url": "----",
"icon_url_large": null,
"type": null,
"rarity": "Exceptional",
"rarity_color": "8847ff",
"price": {
"7_days": {
"average": 3.19,
"median": 3.18,
"sold": "289",
"standard_deviation": "12.46",
"lowest_price": 0.99,
"highest_price": 3.61
},
"30_days": {
"average": 2.84,
"median": 2.8,
"sold": "2835",
"standard_deviation": "11.32",
"lowest_price": 0.99,
"highest_price": 3.61
},
"all_time": {
"average": 1.41,
"median": 2.38,
"sold": "157819",
"standard_deviation": "51.15",
"lowest_price": 0.83,
"highest_price": 3.61
}
},
"first_sale_date": "1607036400"
}
}
That's how the data should look to avoid creating as many classes as the items_list contains elements right?
37 replies
CC#
Created by Bilnord on 1/30/2023 in #help
Newtonsoft .NET Deserialization
what you mean by use dynamic, I did
var json = JsonConvert.DeserializeObject(myJsonString);
Console.WriteLine(json.ToString());
var json = JsonConvert.DeserializeObject(myJsonString);
Console.WriteLine(json.ToString());
and its working if you meant this
37 replies
CC#
Created by Bilnord on 1/30/2023 in #help
Newtonsoft .NET Deserialization
json2csharp.com
37 replies
CC#
Created by Bilnord on 1/30/2023 in #help
Newtonsoft .NET Deserialization
The auto generators are making class for every element in items_list, I have in the list more than 2000 elements and I can not imagine 2000 classes in my code like this
public class 39Blueberries39BuckshotNSWCSEAL
{
public string name { get; set; }
public int marketable { get; set; }
public int tradable { get; set; }
public string classid { get; set; }
public string icon_url { get; set; }
public object icon_url_large { get; set; }
public object type { get; set; }
public string rarity { get; set; }
public string rarity_color { get; set; }
public Price price { get; set; }
public string first_sale_date { get; set; }
}

public class 39MediumRare39CrasswaterGuerrillaWarfare
{
public string name { get; set; }
public int marketable { get; set; }
public int tradable { get; set; }
public string classid { get; set; }
public string icon_url { get; set; }
public object icon_url_large { get; set; }
public object type { get; set; }
public string rarity { get; set; }
public string rarity_color { get; set; }
public Price price { get; set; }
public string first_sale_date { get; set; }
}

public class 39TheDoctor39RomanovSabre
{
public string name { get; set; }
public int marketable { get; set; }
public int tradable { get; set; }
public string classid { get; set; }
public string icon_url { get; set; }
public object icon_url_large { get; set; }
public object type { get; set; }
public string rarity { get; set; }
public string rarity_color { get; set; }
public Price price { get; set; }
public string first_sale_date { get; set; }
}
public class 39Blueberries39BuckshotNSWCSEAL
{
public string name { get; set; }
public int marketable { get; set; }
public int tradable { get; set; }
public string classid { get; set; }
public string icon_url { get; set; }
public object icon_url_large { get; set; }
public object type { get; set; }
public string rarity { get; set; }
public string rarity_color { get; set; }
public Price price { get; set; }
public string first_sale_date { get; set; }
}

public class 39MediumRare39CrasswaterGuerrillaWarfare
{
public string name { get; set; }
public int marketable { get; set; }
public int tradable { get; set; }
public string classid { get; set; }
public string icon_url { get; set; }
public object icon_url_large { get; set; }
public object type { get; set; }
public string rarity { get; set; }
public string rarity_color { get; set; }
public Price price { get; set; }
public string first_sale_date { get; set; }
}

public class 39TheDoctor39RomanovSabre
{
public string name { get; set; }
public int marketable { get; set; }
public int tradable { get; set; }
public string classid { get; set; }
public string icon_url { get; set; }
public object icon_url_large { get; set; }
public object type { get; set; }
public string rarity { get; set; }
public string rarity_color { get; set; }
public Price price { get; set; }
public string first_sale_date { get; set; }
}
37 replies
CC#
Created by Bilnord on 1/30/2023 in #help
Newtonsoft .NET Deserialization
.NET Core
37 replies
CC#
Created by Bilnord on 1/30/2023 in #help
Newtonsoft .NET Deserialization
I have also tried some JSON to C# Generators but failed.
37 replies