def insert_problem_from_json(blob):
"""
Converts json blob of problem(s) into dicts. Runs insert_problem on each one.
See insert_problem for more information.
Returns:
A list of the created problem pids if an array of problems is specified.
"""
result = json_util.loads(blob)
if type(result) == list:
return [insert_problem(problem) for problem in result]
elif type(result) == dict:
return insert_problem(result)
else:
raise InternalException("JSON blob does not appear to be a list of problems or a single problem.")
评论列表
文章目录