0

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

2
  • Check syntax errors with JSONLint (jsonlint.com) Commented Mar 12, 2015 at 8:23
  • Thanks Binkan. But this JSON I am getting dynamically. Commented Mar 12, 2015 at 8:45

2 Answers 2

2

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\"}]}}
Sign up to request clarification or add additional context in comments.

Comments

0

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"
            }
        ]
    }
}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.