Developers extract GitHub statistics for non-technical stakeholders who work in Excel, marketing needs social media metrics in spreadsheets, and finance requires payment data from APIs in CSV format. This drill teaches you to read nested JSON from provided files (simulating API responses), extract fields from complex structures, flatten to tabular format, and export to CSV—bridging the API world with the spreadsheet world.
JSON.parse(File.read(file)) parses JSON from file
Access nested values with hash['key']['nested_key']
Date.parse(string) converts ISO 8601 dates
Calculate days: (Date.today - date).to_i
Use .dig for safe nested access: hash.dig('owner', 'login')
Map array to transform each element: array.map { |item| ... }
CSV writes arrays as rows automatically
convert_json_to_csv('repos.json')
Converted 2 repositories Total stars: 3,000 Most popular: rails-app (2,000 stars)
convert_json_to_csv('repos.json')
Converted 1 repository Total stars: 500 Most popular: solo-repo (500 stars)
convert_json_to_csv('repos.json')
Converted 3 repositories Total stars: 5,400 Most popular: repo-b (5,000 stars)
Console output will appear here...
Are you sure?
You're making great progress