We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
json_load
1 parent 5285c8e commit 73549a5Copy full SHA for 73549a5
1 file changed
vm/src/stdlib/json.rs
@@ -39,6 +39,11 @@ pub fn json_loads(string: PyStringRef, vm: &VirtualMachine) -> PyResult {
39
})
40
}
41
42
+pub fn json_load(fp: PyObjectRef, vm: &VirtualMachine) -> PyResult {
43
+ let result = vm.call_method(&fp, "read", vec![])?;
44
+ json_loads(result.downcast()?, vm)
45
+}
46
+
47
pub fn make_module(vm: &VirtualMachine) -> PyObjectRef {
48
let ctx = &vm.ctx;
49
@@ -53,6 +58,7 @@ pub fn make_module(vm: &VirtualMachine) -> PyObjectRef {
53
58
"dumps" => ctx.new_rustfunc(json_dumps),
54
59
"dump" => ctx.new_rustfunc(json_dump),
55
60
"loads" => ctx.new_rustfunc(json_loads),
61
+ "load" => ctx.new_rustfunc(json_load),
56
62
"JSONDecodeError" => json_decode_error
57
63
64
0 commit comments