I used newtonsoft.json for read the json file. I have this exception.
How can I solve it ?
I tried the inject Profiles headers for use json
CodePudding user response:
You are passing a string
to DeserializeObject.
That string
should contain the actual JSON but you are passing the path to a file.
You need to load the file into a string
or Stream
and parse that instead.
Answers exist already,
Loading a .json file into c# program
In https://stackoverflow.com/help/how-to-ask it says
DO NOT post images of code, data, error messages, etc.—copy or type the text into the question. Please reserve the use of images for diagrams or demonstrating rendering bugs, things that are impossible to describe accurately via text. For more information please see the Meta FAQ entry Why not upload images of code/errors when asking a question?
So, don't do that.
CodePudding user response:
Your laucher_profiles.json can't be mapped to object of Root class becouse they have different structure.
Just copy everything from laucher_profiles.json to https://json2csharp.com/ and web side will build your correct C# classes structure for this json data