title: Javascript Stringify Object
body: <p>I am using MVC 5 and the Select2 plugin in a Ajax form.</p>
  
  <p>The object looks like this in the Chrome console: <a href="http://i.imgur.com/0dFFxkB.jpg" rel="nofollow">http://i.imgur.com/0dFFxkB.jpg</a>
  (was easier to show the object as a picture)</p>
  
  <p>What I would like is to extract the ID and Text and save that to my DB. As a stringified object. Noticed it's alot of other solutions that just saves the ID/Value then do roundtrip to DB for the text.
  But I would like to just stringify the object and only save the id and text and then on page load serialize the object from the hidden field back to the Select2 box.</p>
  
  <p>When I try to use the <code>JSON.stringify</code> method I get an error:</p>
  
  <blockquote>
    <p>Uncaught InvalidStateError: Failed to read the 'selectionDirection' property from 'HTMLInputElement': The input element's type ('hidden') does not support selection.</p>
  </blockquote>