title: How to format API JSON output?
body: <p>I've started to look into using APIs in a python program with Tkinter recently, have so far been able to write a program that pulls travel data using TransportAPI in a travel planner across London tube stations.</p>
  
  <p>The program so far works all fine, the only issue i'm having is formatting the returned JSON data into a readable format for the user. Below is the code for the function that creates the URL and displays the output in the program, and the current output when the program runs.</p>
  
  <p>Creating API URL and returning output:</p>
  
  <pre><code>def create_url(): # creates API url using inputted / chosen values
  
      input_time = get_time()
      input_date = get_date()
  
      station_from = get_source()
      station_to = get_destination()
  
      search_url = 'https://transportapi.com/v3/uk/public/journey/from/'+station_from+'/to/'+station_to+'/at/'+input_date+'/'+input_time+'.json?app_id=bab9c3cc&amp;app_key=0caef97a7e642a7d15f6f59efac6332c&amp;modes=train&amp;not_modes=bus-boat&amp;service=tfl'
  
      return search_url
  </code></pre>
  
  <p>Displaying the output in the program window:</p>
  
  <pre><code>def display_results(): # displays API result to the user
      data = get_data()
      label_search_result.config(text=data)
  </code></pre>
  
  <p>Current output in the program:</p>
  
  <pre class="lang-none prettyprint-override"><code>{"request_time":"2019-06-10T00:50:45+01:00","source":"TfL journey planning
  API","acknowledgements":"Transport for London","routes":
  [{"duration":"00:09:00","route_parts":
  [{"mode":"tube","from_point_name":"Stratford","to_point_name":"Liverpool
  Street","destination":"Ealing
  Broadway","line_name":"Central","duration":"00:09:00","departure_time":"12:46"
  ,"arrival_time":"12:55","coordinates":[[-0.00336,51.54171],[-0.00427,51.54114],[-0.00474,51.54078],[-0.00561,51.54003],[-0.00758,51.53835],[-0.00955,51.53671],[-0.01158,51.53537],[-0.01786,51.53208],[-0.01984,51.53117],[-0.02096,51.53064],[-0.0214,51.53037],[-0.0253,51.52724],[-0.02583,51.52699],[-0.02626,51.52688],[-0.02806,51.52654],[-0.03209,51.52567],[-0.03299,51.52548],[-0.03354,51.52533],[-0.03354,51.52533],[-0.03509,51.52494],[-0.03592,51.5247],[-0.0374,51.52418],[-0.03905,51.52366],[-0.04055,51.52328],[-0.04125,51.52314],[-0.04253,51.52314],[-0.04328,51.52324],[-0.04472,51.5236],[-0.0457,51.52393],[-0.04659,51.52435],[-0.04945,51.52616],[-0.04996,51.52643],[-0.05064,51.52665],[-0.0516,51.52684],[-0.05459,51.52706],[-0.05459,51.52706],[-0.0568,51.52722],[-0.05741,51.52722],[-0.062,51.52673],[-0.06601,51.52627],[-0.06796,51.526],[-0.06924,51.52575],[-0.07011,51.52552],[-0.07173,51.5248],[-0.07397,51.52386],[-0.0751,51.52336],[-0.0762,51.52271],[-0.08219,51.51805]]}],"departure_time":"12:46","departure_date":"2019-07-07","arrival_time":"12:55","arrival_date":"2019-07-07"},{"duration":"00:09:00","route_parts":[{"mode":"tube","from_point_name":"Stratford","to_point_name":"Liverpool Street","destination":"West Ruislip","line_name":"Central","duration":"00:09:00","departure_time":"12:48","arrival_time":"12:57","coordinates":[[-0.00336,51.54171],[-0.00427,51.54114],[-0.00474,51.54078],[-0.00561,51.54003],[-0.00758,51.53835],[-0.00955,51.53671],[-0.01158,51.53537],[-0.01786,51.53208],[-0.01984,51.53117],[-0.02096,51.53064],[-0.0214,51.53037],[-0.0253,51.52724],[-0.02583,51.52699],[-0.02626,51.52688],[-0.02806,51.52654],[-0.03209,51.52567],[-0.03299,51.52548],[-0.03354,51.52533],[-0.03354,51.52533],[-0.03509,51.52494],[-0.03592,51.5247],[-0.0374,51.52418],[-0.03905,51.52366],[-0.04055,51.52328],[-0.04125,51.52314],[-0.04253,51.52314],[-0.04328,51.52324],[-0.04472,51.5236],[-0.0457,51.52393],[-0.04659,51.52435],[-0.04945,51.52616],[-0.04996,51.52643],[-0.05064,51.52665],[-0.0516,51.52684],[-0.05459,51.52706],[-0.05459,51.52706],[-0.0568,51.52722],[-0.05741,51.52722],[-0.062,51.52673],[-0.06601,51.52627],[-0.06796,51.526],[-0.06924,51.52575],[-0.07011,51.52552],[-0.07173,51.5248],[-0.07397,51.52386],[-0.0751,51.52336],[-0.0762,51.52271],[-0.08219,51.51805]]}],"departure_time":"12:48","departure_date":"2019-07-07","arrival_time":"12:57","arrival_date":"2019-07-07"}]}
  </code></pre>
  
  <p>How would I go about formatting this data into something that is more readable by the user? For an idea, the ideal output would be something like this:</p>
  
  <pre class="lang-none prettyprint-override"><code>Source: Stratford
  Destination: London Liverpool Street
  Route:
  Line: Central
  To: Ealing Broadway
  Duration: 09:00
  Departure Time: 12:46
  Arrival Time: 12:55
  
  Source: Stratford
  Destination: London Liverpool Street
  Route:
  Line: Central
  To: West Ruslip
  Duration: 09:00
  Departure Time: 12:48
  Arrival Time: 12:57
  </code></pre>