title: Parsing a colon-separated string into JSON in Node/Javascript
body: <p>I'm working on a Node server, and I used pdftk to extract field data from a PDF to be injected with form data.</p>
  
  <p>I'm trying to get a JSON object of Field Names to iterate over, but I can't seem to get it right.
  It will likely need to be a loop, because it will change based what fields are in the PDF.</p>
  
  <p>This is the string I have from the output.</p>
  
  <pre><code>---
  FieldType: Text
  FieldName: topmostSubform[0].Page1[0].p1-t17[0]
  FieldFlags: 8388608
  FieldValue:
  FieldJustification: Center
  FieldMaxLength: 10
  ---
  FieldType: Text
  FieldName: topmostSubform[0].Page1[0].p1-t20[0]
  FieldFlags: 8388608
  FieldValue:
  FieldJustification: Center
  FieldMaxLength: 10
  ---
  FieldType: Button
  FieldName: topmostSubform[0].Page1[0].p1-cb7[0]
  FieldFlags: 0
  FieldValue:
  FieldJustification: Left
  FieldStateOption: 1
  FieldStateOption: Off
  ---
  FieldType: Text
  FieldName: topmostSubform[0].Page1[0].p1-t38[0]
  FieldFlags: 8388608
  FieldValue:
  FieldJustification: Center
  ---
  FieldType: Text
  FieldName: topmostSubform[0].Page1[0].p1-t50[0]
  FieldFlags: 8388608
  FieldValue:
  FieldJustification: Left
  </code></pre>
  
  <p>Would you recommend regex? What is the best way to go about this problem?</p>