Given a JSON file, read the data and complete the following: Open the JSON file and read the contents into a variable (aka memory) Sort the characters by the dob key Loop through each character and output the sentence in the following format Admiral Jonathan Archer was born on October 09, 2112 and first appeared in Enterprise The sentence in the print() statement should be a single string statement, no commas seperating values Research how to use the sorted() method to sort your dictionaries by a specific key

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Given a JSON file, read the data and complete the following:

  1. Open the JSON file and read the contents into a variable (aka memory)
  2. Sort the characters by the dob key
  3. Loop through each character and output the sentence in the following format
    • Admiral Jonathan Archer was born on October 09, 2112 and first appeared in Enterprise
  4. The sentence in the print() statement should be a single string statement, no commas seperating values
  5. Research how to use the sorted() method to sort your dictionaries by a specific key

work for far:

# Define Main Program
import json

def main():
    with open('x:/json_file.json') as file_object:
        data = json.load(file_object)
    print(data)
    pass


# DO NOT MODIFY BELOW
if __name__ == "__main__":
    # Call Main Program
    main()
 
data.Json
{ "characters": [ { "name_first": "Jonathan", "name_last": "Archer", "rank": "Admiral", "dob": "21121009", "series": "Star Trek: Enterprise" }, { "name_first": "Michael", "name_last": "Burnham", "rank": "Captain", "dob": "22260115", "series": "Star Trek: Discovery" }, { "name_first": "Kathryn", "name_last": "Janeway", "rank": "Vice Admiral", "dob": "23360520", "series": "Star Trek: Voyager" }, { "name_first": "James", "name_last": "Kirk", "rank": "Captain", "dob": "22330322", "series": "Star Trek: The Original Series" }, { "name_first": "Jean Luc", "name_last": "Picard", "rank": "Admiral", "dob": "23050705", "series": "Star Trek: The Next Generation" }, { "name_first": "Christopher", "name_last": "Pike", "rank": "Fleet Captain", "dob": "22190701", "series": "Star Trek: The Original Series" }, { "name_first": "Benjamin", "name_last": "Sisko", "rank": "Captain", "dob": "23321130", "series": "Star Trek: Deep Space Nine" } ] }
 
output should be:
Admiral Jonathan Archer was born on October 09, 2112 and first appeared in Enterprise Fleet Captain Christopher Pike was born on July 01, 2219 and first appeared in The Original Series Captain Michael Burnham was born on January 15, 2226 and first appeared in Discovery Captain James Kirk was born on March 22, 2233 and first appeared in The Original Series Admiral Jean Luc Picard was born on July 05, 2305 and first appeared in The Next Generation Captain Benjamin Sisko was born on November 30, 2332 and first appeared in Deep Space Nine Vice Admiral Kathryn Janeway was born on May 20, 2336 and first appeared in Voyager
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
File Input and Output Operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education