title: How can I convert Json to data frame in R
body: <p>I'd like to convert my json data to data frame in R. Here is what I've done so far:</p>
  
  <pre><code>library("rjson")
  result &lt;- fromJSON(file ="mypath/data.json")
  json_data_frame &lt;- as.data.frame(result)
  </code></pre>
  
  <p>However, it comes to an error like this: </p>
  
  <blockquote>
    <p>Error in data.frame(company_id = "12345678", country_name = "China", 
    :    arguments imply differing number of rows: 1, 2, 0</p>
  </blockquote>
  
  <p>I also tried the following code:</p>
  
  <pre><code>library("rjson")
  result &lt;- fromJSON(file ="mypath/data.json")
  final_data &lt;- do.call(rbind, result)
  </code></pre>
  
  <p>And this error comes up:</p>
  
  <blockquote>
    <p>Warning message: In (function (..., deparse.level = 1)  :   number of
    columns of result is not a multiple of vector length (arg 3)</p>
  </blockquote>
  
  <p>I don't know what is going on here and how can I solve it. I will appreciate if I could get some help on this.</p>
  
  <p>Here are some pieces of my json data:</p>
  
  <p>{"business_id": "1234567", "Country_name": "China", "hours": {"Monday": {"close": "02:00", "open": "11:00"}, "Tuesday": {"close": "02:00", "open": "11:00"}, "Friday": {"close": "02:00", "open": "11:00"}, "Wednesday": {"close": "02:00", "open": "11:00"}, "Thursday": {"close": "02:00", "open": "11:00"}, "Sunday": {"close": "02:00", "open": "12:00"}, "Saturday": {"close": "02:00", "open": "12:00"}}, "open": true, "categories": ["Bars", "Nightlife", "Restaurants"], "city": "Beijing", "review_count": 5, "name": "Chen's Bar", "neighborhoods": ["West End"], "attributes": {"Take-out": true, "Wi-Fi": "free", "Good For": {"dessert": false, "latenight": false, "lunch": false, "dinner": false, "breakfast": false, "brunch": false}, "Good For Dancing": false, "Noise Level": "loud", "Takes Reservations": false, "Delivery": false, "Ambience": {"romantic": false, "intimate": false, "classy": false, "hipster": false, "divey": false, "touristy": false, "trendy": false, "upscale": false, "casual": false}, "Happy Hour": true, "Parking": {"garage": false, "street": false, "validated": false, "lot": false, "valet": false}, "Has TV": true, "Outdoor Seating": false, "Attire": "casual", "Alcohol": "full_bar", "Waiter Service": true, "Accepts Credit Cards": true, "Good for Kids": false, "Good For Groups": true, "Caters": true, "Price Range": 1}, "type": "business"}</p>