Ask Question
20 May, 15:55

Write a function named "read_json" that takes a JSON formatted string as a parameter and return the data represented by the input in the appropriate types for this language. For example, if the input string represents a JSON object you should return a key-value store containing the same data?

+5
Answers (1)
  1. 20 May, 16:11
    0
    Following are the program in the Python Programming Language.

    import json #import package

    #define function

    def read_json (info):

    return json. loads (info) #load data in variable

    #call and print the function

    print (read_json ('[{'A': 10}, {'Y': 16}, {'U': 28}]'))

    Output:

    [{'A': 10}, {'Y': 16}, {'U': 28}]

    Explanation:

    following are the description of the code

    Define function "read_json () " and pass an argument "info" inside it. Return the data inside from the "load () " function. Call the function i. e "read_json" and passing the value to that function. Print function print the data which is inside the "read_json" function.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Write a function named "read_json" that takes a JSON formatted string as a parameter and return the data represented by the input in the ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers