Reputation: 1386
I am getting execption while parsing the below JSON using JSONConvert
{'d':{
'results': [
{
'__metadata': {
'id': 'a4ddaefa-8014-450e-84ff-dada399707',
'uri': 'https://some.server.com/_api/Web/Lists(**GUID**'aaaa-bbbb-cccc-b7b0-eeeee')/Items(1)',
'etag': '\'1\'',
'type': 'SP.Data.TestListItem'
},
'Title': 'sadfsdf'
}
]
}
}
Its throwing error for character after GUID.
Appreciate any help or pointers
Upvotes: 0
Views: 271
Reputation: 4866
This is valid in jsonlint.com. Change single quotes to double except for the uri.
{
"d": {
"results": [
{
"__metadata": {
"id": "a4ddaefa-8014-450e-84ff-dada399707",
"uri": "https: //some.server.com/_api/Web/Lists(**GUID**'aaaa-bbbb-cccc-b7b0-eeeee')/Items(1)",
"etag": "\"1\"",
"type": "SP.Data.TestListItem"
},
"Title": "sadfsdf"
}
]
}
}
Upvotes: 0
Reputation: 3306
you need to have double quotes instead of single quotes:
{
"d": {
"results": [
{
"__metadata": {
"id": "a4ddaefa-8014-450e-84ff-dada399707",
"uri": "https: //some.server.com/_api/Web/Lists(**GUID**'aaaa-bbbb-cccc-b7b0-eeeee')/Items(1)",
"etag": "'1'",
"type": "SP.Data.TestListItem"
},
"Title": "sadfsdf"
}
]
}
}
or formatted compact:
{\"d\":{\"results\":[{\"__metadata\":{\"id\":\"a4ddaefa-8014-450e-84ff-dada399707\",\"uri\":\"https: \/\/some.server.com\/_api\/Web\/Lists(**GUID**\'aaaa-bbbb-cccc-b7b0-eeeee\')\/Items(1)\",\"etag\":\"\'1\'\",\"type\":\"SP.Data.TestListItem\"},\"Title\":\"sadfsdf\"}]}}
Upvotes: 2