zer09 zer09 - 1 month ago 17
C# Question

Couldn't parse json string

I have a json string and tried to parse using json.net but got JsonReaderException (Additional information: After parsing a value an unexpected character was encountered: :. Path 'MedicineQuantityList[0]', line 2, position 8.)

{
"QuantityList":
[
"List": [7,10,14,21,30,50,90,100,200,300],
"Default":100
]
}


I am new to json and i am trying to figure it out, how to fix it.

Thank you for any help.

Answer

Your JSON format is invalid... Keep in mind that '[' is for arrays.

{"QuantityList":{ "List":[7,10,14,21,30,50,90,100,200,300], "Default":100 }}

Try your JSON samples by converting them on this site: http://convertjson.com/json-to-xml.htm