title: Json from two mysql tables in PHP using Object
body: <p>I would like to create a JSON output from those to tables to look like this:</p>
  
  <p>I am trying to build a json output from two related MySQL tables. I have a table of "Restaurants" and table "Dishes" each item in Restaurants table has several relative items in the Dishes table which are referenced by id. Each Restaurant item ID is a foreign key in the Dishes table as f_id.</p>
  
  <pre><code>{
  "Restaurants": [
      {
          "name": "String content",
          "misc info": "String content"
          "Dishes": [
              {
                  "dish": "String content",
                  "description": "String content"
  
              },
              {
                  "dish": "String content",
                  "description": "String content"
              }
          ],
  
      },
      {
          "name": "String content",
          "misc info": "String content"
          "Dishes": [
              {
                  "dish": "String content",
                  "description": "String content"
              },
              {
                  "dish": "String content",
                  "description": "String content"
              }
          ],
  
      }
  ]
  </code></pre>
  
  <p>}</p>