I am getting Invalid property identifier character: ‘. Path '', line 1, position 1 while parsing json string to object. My Json string look like this
{‘name’ : ‘Account’ , ‘placeholder’ : ‘Enter Accountant Name’ , ‘label’ : ‘Account Name’ , ‘type’ : ‘string’ , ‘mode’: ‘multiline’}
and the class look like this
public class TemplateModel
{
public string name { get; set; }
public string type { get; set; }
public string placeholder { get; set; }
public string label { get; set; }
public string mode { get; set; } = "single";
}
I am getting error in this line.
var list = JsonConvert.DeserializeObject(d);
I have checked the Newtonsoft.Json doucument and found a example when i copy the example and replace with my keys and static values. It works fine. string from example look like this.
var c= @"{'name': '[email protected]', 'type': 'string', 'label': 'Name', 'placeholder':'Enter Name', 'mode': 'multiline'}";
When i validate my json string in json validator online it validated properly except it replace my ' ' to " " but i have used ' ' because it is used like this in Newtonsoft.Json example.
I am reading my json string template from word file. My json looks like this in text visulazar.
https://ibb.co/XjWrmS7
Please help.
I created this issue in fiddle, Please check https://dotnetfiddle.net/BTma0B
Looks like you are having smart quotes instead of the normal quotes.
I tried the following with normal quotes on the server side
{
"name":"Account",
"placeholder":"Enter Accountant Name",
"label":"Account Name",
"type":"string",
"mode":"multiline"
}
and this works fine.
Can you verify by changing the quotes if that works for you?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With