title: PHP How to parse a file with unproper json format
body: <p>I need to parse a file that looks like a JSON file but it ain't. It misses the <code>:</code> char so i cannot parse it using <code>json_decode</code>. I'm not the owner of this file so i have to take it like it is.. How can i parse this file ? Any thoughts? Thank you </p>
  
  <pre><code>"sound_materials"
  {
      "common"
      {
          "value"     "0"
          "start_drag_sound"      "ui.inv_pickup"
          "end_drag_sound"        "ui.inv_drop"
          "equip_sound"       "ui.inv_equip"
      }
      "chest"
      {
          "value"     "1"
          "start_drag_sound"      "ui.inv_pickup_chest"
          "end_drag_sound"        "ui.inv_drop_chest"
      }
      "pennant"
      {
          "value"     "2"
          "start_drag_sound"      "ui.inv_pickup_pennant"
          "end_drag_sound"        "ui.inv_drop_pennant"
      }
      "key"
      {
          "value"     "3"
          "start_drag_sound"      "ui.inv_pickup_key"
          "end_drag_sound"        "ui.inv_drop_key"
      }
      "metal_small"
      {
          "value"     "4"
          "start_drag_sound"      "ui.inv_pickup_metalsmall"
          "end_drag_sound"        "ui.inv_drop_metalsmall"
          "equip_sound"       "ui.inv_equip_metalsmall"
      }
      "metal_armor"
      {
          "value"     "5"
          "start_drag_sound"      "ui.inv_pickup_metalarmour"
          "end_drag_sound"        "ui.inv_drop_metalarmour"
          "equip_sound"       "ui.inv_equip_metalarmour"
      }
      "metal_blade"
      {
          "value"     "6"
          "start_drag_sound"      "ui.inv_pickup_metalblade"
          "end_drag_sound"        "ui.inv_drop_metalblade"
          "equip_sound"       "ui.inv_equip_metalblade"
      }
      "metal_heavy"
      {
          "value"     "7"
          "start_drag_sound"      "ui.inv_pickup_metalheavy"
          "end_drag_sound"        "ui.inv_drop_metalheavy"
          "equip_sound"       "ui.inv_equip_metalheavy"
      }
      "staff_or_blunt"
      {
          "value"     "8"
          "start_drag_sound"      "ui.inv_pickup_staff"
          "end_drag_sound"        "ui.inv_drop_staff"
          "equip_sound"       "ui.inv_equip_staff"
      }
      "robes"
      {
          "value"     "9"
          "start_drag_sound"      "ui.inv_pickup_robes"
          "end_drag_sound"        "ui.inv_drop_robes"
          "equip_sound"       "ui.inv_equip_robes"
      }
      "leather"
      {
          "value"     "10"
          "start_drag_sound"      "ui.inv_pickup_leather"
          "end_drag_sound"        "ui.inv_drop_leather"
          "equip_sound"       "ui.inv_equip_leather"
      }
      "quiver"
      {
          "value"     "11"
          "start_drag_sound"      "ui.inv_pickup_quiver"
          "end_drag_sound"        "ui.inv_drop_quiver"
          "equip_sound"       "ui.inv_equip_quiver"
      }
      "stone"
      {
          "value"     "12"
          "start_drag_sound"      "ui.inv_pickup_stone"
          "end_drag_sound"        "ui.inv_drop_stone"
          "equip_sound"       "ui.inv_equip_stone"
      }
      "wood"
      {
          "value"     "13"
          "start_drag_sound"      "ui.inv_pickup_wood"
          "end_drag_sound"        "ui.inv_drop_wood"
          "equip_sound"       "ui.inv_equip_wood"
      }
      "bone"
      {
          "value"     "14"
          "start_drag_sound"      "ui.inv_pickup_bone"
          "end_drag_sound"        "ui.inv_drop_bone"
          "equip_sound"       "ui.inv_equip_bone"
      }
      "jug"
      {
          "value"     "15"
          "start_drag_sound"      "ui.inv_pickup_jug"
          "end_drag_sound"        "ui.inv_drop_jug"
          "equip_sound"       "ui.inv_equip_jug"
      }
      "gun"
      {
          "value"     "16"
          "start_drag_sound"      "ui.inv_pickup_gun"
          "end_drag_sound"        "ui.inv_drop_gun"
          "equip_sound"       "ui.inv_equip_gun"
      }
      "highvalue"
      {
          "value"     "17"
          "start_drag_sound"      "ui.inv_pickup_highvalue"
          "end_drag_sound"        "ui.inv_drop_highvalue"
          "equip_sound"       "ui.inv_equip_highvalue"
      }
  }
  </code></pre>
  
  <p><strong>EDIT:</strong></p>
  
  <p>So i used the regex that h2o suggered and it works great to format the file. My mistake is that in the example above i only put a part with 1 line key. </p>
  
  <p>I have some others part of the file where you have sub keys and in this case i should need to add the [ ] delimiter for subkeys.. :</p>