0

I save a JSON string in my SharePoint list. This looks like:

{"columns":[{"name":"A","visible":true,"width":200,"sort":{},"filters":[{}],"pinned":"left"},{"name":"B","visible":false,"width":150,"sort":{},"filters":[{}],"pinned":""},{"name":"C","visible":true,"width":200,"sort":{},"filters":[{}],"pinned":""},{"name":"D","visible":true,"width":200,"sort":{},"filters":[{}],"pinned":""}],"scrollFocus":{},"selection":[],"grouping":{},"treeView":{}}

But if I request it from the SharePoint I get:

{
  "d": {
    "results": [
      {
        "__metadata": {
          "id": "Web/Lists(guid'78e7e9bc-d85f-4c18-8aeb-213a68b28154')/Items(1)",
          "uri": "http://sharepoint2013/sites/acme/demo/_api/Web/Lists(guid'78e7e9bc-d85f-4c18-8aeb-213a68b28154')/Items(1)",
          "etag": "\"1\"",
          "type": "SP.Data.SettingsListItem"
        },
        "Configuration": "<div class=\"ExternalClass41AB4CF73C1C4DCB82C4F0B8CCCBC7AE\">&#123;&quot;columns&quot;&#58;[&#123;&quot;name&quot;&#58;&quot;A&quot;,&quot;visible&quot;&#58;true,&quot;width&quot;&#58;200,&quot;sort&quot;&#58;&#123;&#125;,&quot;filters&quot;&#58;[&#123;&#125;],&quot;pinned&quot;&#58;&quot;left&quot;&#125;,&#123;&quot;name&quot;&#58;&quot;B&quot;,&quot;visible&quot;&#58;false,&quot;width&quot;&#58;150,&quot;sort&quot;&#58;&#123;&#125;,&quot;filters&quot;&#58;[&#123;&#125;],&quot;pinned&quot;&#58;&quot;&quot;&#125;,&#123;&quot;name&quot;&#58;&quot;C&quot;,&quot;visible&quot;&#58;true,&quot;width&quot;&#58;200,&quot;sort&quot;&#58;&#123;&#125;,&quot;filters&quot;&#58;[&#123;&#125;],&quot;pinned&quot;&#58;&quot;&quot;&#125;,&#123;&quot;name&quot;&#58;&quot;D&quot;,&quot;visible&quot;&#58;true,&quot;width&quot;&#58;200,&quot;sort&quot;&#58;&#123;&#125;,&quot;filters&quot;&#58;[&#123;&#125;],&quot;pinned&quot;&#58;&quot;&quot;&#125;],&quot;scrollFocus&quot;&#58;&#123;&#125;,&quot;selection&quot;&#58;[],&quot;grouping&quot;&#58;&#123;&#125;,&quot;treeView&quot;&#58;&#123;&#125;&#125;</div>"
      }
    ]
  }
}

So why? The SharePoint show it correct... So why the REST API must encode it? -.-

enter image description here

Thank you in Advance for any ideas!

  • Sharepoint simply treats your JSON as yet another text in multi line field, it's obvious to encode whatever in the field. – Rajesh Sitaraman Apr 15 '16 at 1:47
0

This is probably because your field type is enhanced mutliline text. Instead if you switch it to plain text multiline, it should be able to return the data as is.

I think you would need to create a new item after changing field type though. Old item will likely remain the way it is.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.