title: I want to build JSON object in android from a table in mysql database contains a foreign key?
body: <p>I need some help.</p>
  
  <p>What I need to do basically, it's a simple mapping relation (FK) between to databases and bring this as JSON (using java).</p>
  
  <p>For example, how can i change this script:</p>
  
  <pre><code>        JSONArray ja=new JSONArray(jsonData);
  
          JSONObject jo=null;
  
          for(int i=0;i&lt;ja.length();i++)
          {
              jo=ja.getJSONObject(i);
  
              int id=jo.getInt("0");
              int course_id=jo.getInt("4");// it is an a primary key for another table
  
              String hour=jo.getString("2");
         }
  </code></pre>
  
  <blockquote>
    <p>Table: Schedule  { schedule_id : primary key course_id : foreign key
    ,hour}</p>
    
    <p>Table : Course  {course_id : primary key course_name  }</p>
  </blockquote>