Answers.Body: <p>It's a little tough to say, since you it seems like you haven't actually architected any of this in the Craft back-end yet. I encourage you to create a field (or fields) which would be a good container for this data.</p>
  
  <p>Once you've established what kind of field you're using, you may find that there is a different answer... but based on your current intent to store a simple JSON object, it sounds like you'd be using a simple plain text field.</p>
  
  <p>Assuming you're using a plain text field, this is actually quite simple to accomplish. <strong>Use your JavaScript to set the <code>value</code> of a hidden field, before submitting the form:</strong></p>
  
  <pre><code>&lt;input type="hidden" name="fields[songsJson]" value="" /&gt;
  </code></pre>
  
  <p>More info on saving entry data from a front-end form:</p>
  
  <blockquote>
    <p><a href="https://craftcms.com/docs/templating/entry-form" rel="nofollow">https://craftcms.com/docs/templating/entry-form</a></p>
  </blockquote>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-20T21:13:50.590Z
Answers.Text: Right, so I can basically just store this stuff via an Ajax handler then? Sounds reasonable enough :) I haven't used forms Craft yet to this will be interesting to see if I can create a nice effect for the callback (if there is any).
Answers.UserDisplayName: Kenny Bones
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-20T21:16:10.383Z
Answers.Text: Yup, it's pretty much just a plain container for your JSON. Out of curiosity, did you want that data to be useful on the back-end? A block of JSON data won't really be helpful in the control panel at all... I suspect there are better ways to architect that data.
Answers.UserDisplayName: Lindsey D
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-20T21:22:26.603Z
Answers.Text: Actually, I couldn't care less about the back end on this project. I want to tie as much as possible up to the front end. The people who'll be using this are musicians and some of them have zero know how on computers in general. But it's interesting! :)
Answers.UserDisplayName: Kenny Bones
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-20T21:23:39.383Z
Answers.Text: Alright, fair enough... plain text field it is!
Answers.UserDisplayName: Lindsey D
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-20T21:10:54.010Z
Answers.LastActivityDate: 2016-03-20T21:10:54.010Z
Answers.UserDisplayName: Lindsey D
Body: <p>I'm creating a page where I have a bunch of entries I want to populate with jquery drag and drop boxes. It's for the arrangement of songs, just as a tool. </p>
  
  <p>And I want to store the position of these in a JSON object. When I was using Expression Engine I managed to send an SQL command and store the data in the correct fields. Albeit it was kinda wonky.</p>
  
  <p>But now I'm using Craft so I figure there might way better ways of doing stuff like this. Do I use a form? Do I hide that form and send it using AJAX every time I make some changes to the jquery drag and drop boxes?</p>
  
  <p><a href="https://i.sstatic.net/PJGuo.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/PJGuo.png" alt="enter image description here"></a></p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-03-20T20:49:29.663Z
Comments.Text: What kind of field (or fields) is it on the back-end? How that data is being stored in the Craft CP will affect the answer.
Comments.UserDisplayName: Lindsey D
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-03-20T20:57:44.000Z
Comments.Text: I haven't created any fields yet. But I imagine I'll have separate entries, with their own data in them. Just like any other blog site really.
Comments.UserDisplayName: Kenny Bones
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-03-20T20:59:39.447Z
Comments.Text: What are the "things" that you're dragging & dropping? Are you rearranging the order of full entries?
Comments.UserDisplayName: Lindsey D
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-03-20T21:03:41.483Z
Comments.Text: See my updated post :) As of now, I only add divs to a container, and then add jquery drag and drop and resize method on them. Nothing fancy yet.
  
  It's these divs that I want to store the information of, in the JSON object
Comments.UserDisplayName: Kenny Bones
Tags: <form><frontend><entries-field>
Title: The smoothest way to store JSON object to an entry?
ThreadText: # The smoothest way to store JSON object to an entry?
  
  (Asked by: username_0 on 2016-03-20)
  
  I'm creating a page where I have a bunch of entries I want to populate with jquery drag and drop boxes. It's for the arrangement of songs, just as a tool.
  
  And I want to store the position of these in a JSON object. When I was using Expression Engine I managed to send an SQL command and store the data in the correct fields. Albeit it was kinda wonky.
  
  But now I'm using Craft so I figure there might way better ways of doing stuff like this. Do I use a form? Do I hide that form and send it using AJAX every time I make some changes to the jquery drag and drop boxes?
  
  [![enter image description here](https://i.sstatic.net/PJGuo.png)](https://i.sstatic.net/PJGuo.png)
  
  **Tags:** form, frontend, entries-field
  
  > **Comments:**
  > **username_1**: What kind of field (or fields) is it on the back-end? How that data is being stored in the Craft CP will affect the answer.  
  > **username_0**: I haven't created any fields yet. But I imagine I'll have separate entries, with their own data in them. Just like any other blog site really.  
  > **username_1**: What are the "things" that you're dragging & dropping? Are you rearranging the order of full entries?  
  > **username_0**: See my updated post :) As of now, I only add divs to a container, and then add jquery drag and drop and resize method on them. Nothing fancy yet.  It's these divs that I want to store the information of, in the JSON object  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2016-03-20. Score: 3 | Accepted answer
  
  It's a little tough to say, since you it seems like you haven't actually architected any of this in the Craft back-end yet. I encourage you to create a field (or fields) which would be a good container for this data.
  
  Once you've established what kind of field you're using, you may find that there is a different answer... but based on your current intent to store a simple JSON object, it sounds like you'd be using a simple plain text field.
  
  Assuming you're using a plain text field, this is actually quite simple to accomplish. **Use your JavaScript to set the `value` of a hidden field, before submitting the form:**
  
  ```
  <input type="hidden" name="fields[songsJson]" value="" />
  
  ```
  
  More info on saving entry data from a front-end form:
  
  > <https://craftcms.com/docs/templating/entry-form>
  
  > **Comments:**
  > **username_0**: Right, so I can basically just store this stuff via an Ajax handler then? Sounds reasonable enough :) I haven't used forms Craft yet to this will be interesting to see if I can create a nice effect for the callback (if there is any).  
  > **username_1**: Yup, it's pretty much just a plain container for your JSON. Out of curiosity, did you want that data to be useful on the back-end? A block of JSON data won't really be helpful in the control panel at all... I suspect there are better ways to architect that data.  
  > **username_0**: Actually, I couldn't care less about the back end on this project. I want to tie as much as possible up to the front end. The people who'll be using this are musicians and some of them have zero know how on computers in general. But it's interesting! :)  
  > **username_1**: Alright, fair enough... plain text field it is!  
  
  ---
  
  