2 minutes to read - Mar 30, 2023

Build a list and convert it to JSON & csv format

VISIT
Build a list of 10 US cities with capitals. Convert the list to JSON and convert it to a csv format.

1. Washington, D.C. (Capital: Washington, D.C.)

2. Boston, Massachusetts (Capital: Boston, Massachusetts)

3. New York City, New York (Capital: Albany, New York)

4. Philadelphia, Pennsylvania (Capital: Harrisburg, Pennsylvania)

5. Atlanta, Georgia (Capital: Atlanta, Georgia)

6. Chicago, Illinois (Capital: Springfield, Illinois)

7. Dallas, Texas (Capital: Austin, Texas)

8. Denver, Colorado (Capital: Denver, Colorado)

9. San Francisco, California (Capital: Sacramento, California)

10. Seattle, Washington (Capital: Olympia, Washington)

JSON: {"cities": \[{"name": "Washington, D.C.", "capital": "Washington, D.C."}, {"name": "Boston, Massachusetts", "capital": "Boston, Massachusetts"}, {"name": "New York City, New York", "capital": "Albany, New York"}, {"name": "Philadelphia, Pennsylvania", "capital": "Harrisburg, Pennsylvania"}, {"name": "Atlanta, Georgia", "capital": "Atlanta, Georgia"}, {"name": "Chicago, Illinois", "capital": "Springfield, Illinois"}, {"name": "Dallas, Texas", "capital": "Austin, Texas"}, {"name": "Denver, Colorado", "capital": "Denver, Colorado"}, {"name": "San Francisco, California", "capital": "Sacramento, California"}, {"name": "Seattle, Washington", "capital": "Olympia, Washington"}\]}

CSV: "Name","Capital" "Washington, D.C.","Washington, D.C." "Boston, Massachusetts","Boston, Massachusetts" "New York City, New York","Albany, New York" "Philadelphia, Pennsylvania","Harrisburg, Pennsylvania" "Atlanta, Georgia","Atlanta, Georgia" "Chicago, Illinois","Springfield, Illinois" "Dallas, Texas","Austin, Texas" "Denver, Colorado","Denver, Colorado" "San Francisco, California","Sacramento, California" "Seattle, Washington","Olympia, Washington"

Article source
loading...