← Code LabPython0/50 solved · 0%
Web3 integration · medium

31. Validating parsed JSON

Check required fields before trusting data.

Write `parse_block(raw)` that `json.loads`s a raw JSON string and raises `ValueError` if any of `"number"`, `"hash"`, `"transactions"` is missing, otherwise returns the parsed dict.
Required in your answer: json.loadsraise ValueError