title: Displaying JSON data in Tabular format using R
body: <p>I currently want to use Rstudio extract the JSON data and display it in a neat tabular format.This is the JSON Data I am currently using:</p>
  
  <pre><code>{
    "id": "12345",
    "company": {
      "carid": "23456",
      "companyCode": "T.FX05",
      "companyName": "Toyota",
      "companyMethodology": {
        "$id": "34567",
        "meth": null
      },
      "Midnightshift": 0,
      "cars": [
        {
          "carid": "78910",
          "carcode": "T.FX07",
          "cardetails": {
            "carid": "45678",
            "cardetailscode": "T.MPV",
            "carname": "camry",
          },
          "specialisedcarCode": null
        },
        {
          "carid": "67892",
          "code": "T.FX08",
          "cardetails": {
            "carid": "89546",
            "cardetailscode": "T.CEA",
            "carname": "celica",
          },
          "specialisedcarCode": null
          }
      ]
    }
  }
  </code></pre>
  
  <p>I am currently using the following code:</p>
  
  <pre><code>#install.packages("rjson")
  
  library("rjson")
  
  
  json_file &lt;- "http:xxxx"
  
  json_data &lt;- fromJSON(file=json_file)
  json_data_car &lt;- json_data$company$cars
  
  finalTable_car &lt;- as.data.frame(do.call(rbind, json_data_car))
  </code></pre>
  
  <p>The above code allows me to extract the data and display tables of 'Company' and 'Cardetails'. However, I am getting errors when I try to extract the data further and  display the data of 'cardetails'.  </p>
  
  <pre><code>json_data_car &lt;- json_data$company$cars$cardetails
  </code></pre>
  
  <blockquote>
    <p>The error I am getting is: Error in do.call(rbind, json_data_car) :<br>
    second argument must be a list</p>
  </blockquote>
  
  <p>Any ideas how to go about it and display all the data in a table format? </p>