diff --git a/vlib/json/json_decode_test.v b/vlib/json/json_decode_test.v index 2c4448fcae..5b21838835 100644 --- a/vlib/json/json_decode_test.v +++ b/vlib/json/json_decode_test.v @@ -33,3 +33,14 @@ fn test_json_decode_works_with_a_dict_of_arrays() { assert res.twins[1].seed == 'dfgdfgdfgd' assert res.twins[1].pubkey == 'skjldskljh45sdf' } + +struct Mount { + size u64 +} + +fn test_decode_u64() ? { + data := '{"size": 10737418240}' + m := json.decode(Mount, data) ? + assert m.size == 10737418240 + println(m) +} diff --git a/vlib/json/json_primitives.v b/vlib/json/json_primitives.v index 0631899144..2e635e5e4e 100644 --- a/vlib/json/json_primitives.v +++ b/vlib/json/json_primitives.v @@ -96,7 +96,7 @@ fn decode_u64(root &C.cJSON) u64 { if isnil(root) { return u64(0) } - return u64(root.valueint) + return u64(root.valuedouble) } fn decode_f32(root &C.cJSON) f32 {