title: Symfony2 form to JSON structure
body: <p>How can the Symfony2 form be transformed to JSON data structure? Looking for proper bundle gave me no results;</p>
  
  <p>Example:</p>
  
  <pre><code>$builder
      -&gt;add('name', 'text')
      -&gt;add('password', 'password')
  ;
  </code></pre>
  
  <p>Would result in something like that:</p>
  
  <pre><code>{
      fields: {
          name: {
              type: 'text'
          },
          password: {
              type: 'password'
          }
      }
  }
  </code></pre>
  
  <p>Iterating over each element in form after <code>$form = $this-&gt;createForm(new FormType(), new Entity())</code> was not helpful, could not find some properties that could be defined in form builder.</p>