title: Convert json object to spatial lines data frame
body: <p>I downloaded a geojson file of Iraq's electrical grid from EnergyData. You can download the file yourself <a href="https://development-data-hub-s3-public.s3.amazonaws.com/ddhfiles/145188/electric-network-iraq.geojson" rel="nofollow noreferrer">here</a> and visit the webpage <a href="https://energydata.info/dataset/iraq-electricity-transmission-network-2017/resource/4a302ef4-0d79-47db-b301-7b40293067b0" rel="nofollow noreferrer">here</a></p>
  <p>I tried to use <code>geojsonio::geojson_read</code> to read the file into R, but it threw errors. Another user helpfully pointed out that the file format provided by the Energy Data website is incorrect and does not comply with geojson format, so the filename is misleading. So they recommended I use <code>jsonlite::read_json</code>. While that function does read the file into R, it's not a spatial object. It's a multi-level list. I also tried <code>sf::st_read</code> but the object is a messy data frame. I need my final object to be a spatial lines data frame, so I can merge and crop it with another spatial lines objects and write out the resulting shapefile. But when I try <code>sp::SpatialLinesDataFrame</code> I can't index into the object correctly to connect the lines in the right order. I need the object in R to look like the picture on the web page, and instead its just a hot mess.</p>
  <p>Here's my code:</p>
  <pre><code>library(geojsonio)
  library(jsonlite)
  library(sf)
  library(sp)
  
  Iraq_electric_json &lt;- jsonlite::read_json(&quot;Filepath/electric-network-iraq.geojson&quot;)
  
  Iraq_electric_df &lt;- sf::st_read(&quot;Filepath/electric-network-iraq.geojson&quot;)
  
  # ERRORS HERE
  Sldf &lt;- SpatialLinesDataFrame(data = Iraq_electric_df$geometry)
  </code></pre>
  <p>I posted part one of my question (how to read in a geojson file) here:</p>
  <p><a href="https://stackoverflow.com/questions/70511049/geojsoniogeojson-read-error-for-a-geojson-file-conversion-from-feature-type-s?noredirect=1#comment124643131_70511049">geojsonio::geojson_read error for a geojson file &quot;conversion from feature type sfc_GEOMETRY to sp is not supported&quot;</a></p>
  <p>But since part 2 of the question (changing object format) is so different from part 1, I decided to post a whole new question.</p>