I have a web project using angular and C#.
In a C# controller, I want to read in the contents of a local json file that is used for testing.
This is the code that I run to read the JSON from my working directory.
string path = HttpContext.Current.Server.MapPath("~/testing/testData.json");
JObject jsonData = JObject.Parse(path);
string jsonString = jsonData.ToString();
List<orResult> result = JsonConvert.DeserializeObject<List<orResult>>(jsonString);
return result;
The JSON can be seen here. Json
When I run the app, I get the following error.
An exception of type 'Newtonsoft.Json.JsonReaderException' occurred in Newtonsoft.Json.dll but was not handled in user code
Additional information: Unexpected character encountered while parsing value: M. Path '', line 0, position 0.
When I hover look at the path variable, it points to the right spot. If I copy and paste the path variable in to my browser, I see the JSON. The error is something with Parsing the data or something... I have no idea. Need help!
I've looked at other solutions on Stack and none of them resolved my problem.