title: Can I dynamically create a mySQL table from JSON?
body: <p>Let's say I have a server side  script which generates JSON from a simple select on a table. The JSON is encoded in the 1st script.</p>
  
  <p>I have no control over this 1st script, but am aware when the underlying database structure changes and when the JSON structure changes.</p>
  
  <p>Script 2 uses CURL to get the <code>.js</code> file (contents) which contains the JSON, I can then decode into an array.</p>
  
  <p>What I need to do then is store the data in another database.</p>
  
  <p>My question is basically about automating this process and being able to create a table from an array when you don't know what the structure of the array is until it arrives.</p>
  
  <p>Can it be done?</p>
  
  <p><strong>EDIT</strong> Added the JSON as it currently stands, but the point is it might change.</p>
  
  <pre><code>{"name": "Google",
   "homepage_url": "http://www.google.com",
   "blog_url": "",
   "blog_feed_url": "",
   "twitter_username": "",
   "category_code": "ecommerce",
   "tag_list": "retail-portal-online-shopping-markets",
   "alias_list": null,
   "image": null,
   "products":
    [],
   "relationships":
    [],
   "competitions":
    [],
   "providerships":
    [{"title": "Legal",
      "is_past": false,
      "provider":
       {"name": "TaylorWessing",
        "permalink": "taylorwessing"}}],
   "offices":
    [{"description": "European HQ",
      "address1": "",
      "address2": "",
      "zip_code": "",
      "city": "Brussels",
      "state_code": null,
      "country_code": "BEL",
      "latitude": null,
      "longitude": null}]}
  </code></pre>