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;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text.Json;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using Newtonsoft.Json.Serialization;
|
||||||
using InfoferScraper;
|
using InfoferScraper;
|
||||||
using InfoferScraper.Scrapers;
|
using InfoferScraper.Scrapers;
|
||||||
|
|
||||||
|
|
@ -39,11 +40,13 @@ async Task PrintTrain() {
|
||||||
}
|
}
|
||||||
|
|
||||||
Console.WriteLine(
|
Console.WriteLine(
|
||||||
JsonSerializer.Serialize(
|
JsonConvert.SerializeObject(
|
||||||
await new TrainScraper().Scrape(trainNumber),
|
await new TrainScraper().Scrape(trainNumber),
|
||||||
new JsonSerializerOptions {
|
new JsonSerializerSettings {
|
||||||
PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
|
Formatting = Formatting.Indented,
|
||||||
WriteIndented = true,
|
ContractResolver = new DefaultContractResolver {
|
||||||
|
NamingStrategy = new CamelCaseNamingStrategy(),
|
||||||
|
},
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
@ -57,11 +60,13 @@ async Task PrintStation() {
|
||||||
}
|
}
|
||||||
|
|
||||||
Console.WriteLine(
|
Console.WriteLine(
|
||||||
JsonSerializer.Serialize(
|
JsonConvert.SerializeObject(
|
||||||
await new StationScraper().Scrape(stationName),
|
await new StationScraper().Scrape(stationName),
|
||||||
new JsonSerializerOptions {
|
new JsonSerializerSettings {
|
||||||
PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
|
Formatting = Formatting.Indented,
|
||||||
WriteIndented = true,
|
ContractResolver = new DefaultContractResolver {
|
||||||
|
NamingStrategy = new CamelCaseNamingStrategy(),
|
||||||
|
},
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue