Use Newtonsoft.Json in ConsoleTest

This commit is contained in:
Kenneth Bruen 2026-06-24 04:53:20 +02:00
parent 585025324f
commit 988df9652a
Signed by: kbruen
GPG key ID: C1980A470C3EE5B1

View file

@ -1,7 +1,8 @@
using System;
using System.Linq;
using System.Text.Json;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
using InfoferScraper;
using InfoferScraper.Scrapers;
@ -39,11 +40,13 @@ async Task PrintTrain() {
}
Console.WriteLine(
JsonSerializer.Serialize(
JsonConvert.SerializeObject(
await new TrainScraper().Scrape(trainNumber),
new JsonSerializerOptions {
PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
WriteIndented = true,
new JsonSerializerSettings {
Formatting = Formatting.Indented,
ContractResolver = new DefaultContractResolver {
NamingStrategy = new CamelCaseNamingStrategy(),
},
}
)
);
@ -57,11 +60,13 @@ async Task PrintStation() {
}
Console.WriteLine(
JsonSerializer.Serialize(
JsonConvert.SerializeObject(
await new StationScraper().Scrape(stationName),
new JsonSerializerOptions {
PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
WriteIndented = true,
new JsonSerializerSettings {
Formatting = Formatting.Indented,
ContractResolver = new DefaultContractResolver {
NamingStrategy = new CamelCaseNamingStrategy(),
},
}
)
);