Keyboard Shortcuts
Лайки
Пошук
Newtonsoft JSON Compiler Error in VS2008
Hi, I'm trying to read JSON from a stream in VS2008 and getting a compiler error that doesn't exist if I was compiling with VS2019. The code is as follows: JsonSerializer serializer = new JsonSerializer(); I get the following errors on the line "using (var jsonTextReader = new JsonTextReader(steamReader))" Error 5 The best overloaded method match for
'Newtonsoft.Json.JsonTextReader.JsonTextReader(System.IO.TextReader)'
has some invalid arguments Any ideas on working around this problem would be greatly appreciated. Thanks in advance for the help Jay |
Thanks. Actually, I am using the compact framework. However, I've worked around the problem. I used a totally different mechanism for getting the data and deserializing the JSON. So, my codes working now Thanks again Jay On 11/5/2024 6:21 PM, dontrobthemachina
via groups.io wrote:
|
If you're in VS2008/CF3.5 land on 3-series processors, here's a basic JSON serialize/deserialize. Build a class to hold the data types in your config file - in my case it's named Scheduler: string fname = @"\NVRAM\schedule.json"; // from file string json = File.ReadToEnd(fname, Encoding.UTF8); Scheduler sched = JsonConvert.DeserializeObject<Scheduler>(json); // to file string json = JsonConvert.SerializeObject(this); StreamWriter sw = new StreamWriter(fname, sched); sw.Write(json); sw.Close();
|
Повідомлення
Більше