CJCoding With Joseph
15free / daySign inCreate account

Decode A JSON Line

The JSON object read from input (one line with the keys title and pages) is written to book.json. Open the file for reading, read the text back with f.read() into text, decode it with json.loads into book and print <title> has <pages> pages from that dict. Input: one line of JSON, no prompt. Import only json.

Expected Output:

Dune has 412 pages

= newline. The output ends with a newline — print one after the last line.

Hints3 available
Topics:
FilesJSON
📥 Auto-Input:
{"title": "Dune", "pages": 412}\n
This input is automatically fed to your program's stdin
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Ctrl+Space to expand shortcuts (pr, inp, def)

Your Output

Run your code to see the output here...

Test Cases

Run your code to see test case results.