I'm new to Magento 2 and I'm trying to add a multiselect of all (for now) CMS pages to the CMS pages in Magento 2. What I mean by this is that when creating/editing a CMS page, there should be an extra field with all (other) CMS pages from which you can select multiple (or just one or none at all), just like you have a multiselect for the Store View field. I have got it to work to render the multiselect and you can select multiple, but upon saving it shows a message that "something" went wrong. Example of the fields: 
I've also created an upgrade script which has successfully created an extra field in the cms_page table. I can still save pages, but only when I don't select any CMS pages.
Here's my //view/adminhtml/ui_component/cms_page_form.xml
<?xml version="1.0" encoding="UTF-8"?> <form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd"> <fieldset name="search_engine_optimisation"> <field name="redirect_to"> <argument name="data" xsi:type="array"> <item name="options" xsi:type="object">Magento\Cms\Model\Config\Source\Page</item> <item name="config" xsi:type="array"> <item name="dataType" xsi:type="string">int</item> <item name="label" xsi:type="string" translate="true">Redirect to pages</item> <item name="formElement" xsi:type="string">multiselect</item> <item name="source" xsi:type="string">page</item> <item name="dataScope" xsi:type="string">redirect_to</item> <item name="default" xsi:type="string">0</item> <item name="validation" xsi:type="array"> <item name="required-entry" xsi:type="boolean">false</item> </item> </item> </argument> </field> </fieldset> </form> What am I missing or doing wrong? For some reason, I've gotten it to work but it would only save one, never multiple, but I can't seem to reproduce that anymore.
What I'd like to achieve is for it to save all selected options as a JSON encoded string with the store id as key and the URL as value. How would I go about doing this?
Any help is much appreciated.