Use Newtonsoft.Json in ConsoleTest
This commit is contained in:
parent
585025324f
commit
988df9652a
1 changed files with 19 additions and 14 deletions
|
|
@ -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(),
|
||||
},
|
||||
}
|
||||
)
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue