据我了解,这 {"xxx": 1000000000000000} 是有效的吗?
不知道如何用 Yojson.Safe 解析它。我正在寻找类似 _ `Int64 of int64 _ 的东西,但没有提供,只有 _ `Int of int _ 和 _ `Intlit of string _ 在 api 上。
编辑,这是我的问题
let x = "{\"xxx\": 10000000000000}"
let json = Yojson.Safe.from_string x
match json with `Assoc [("xxx", `Intlit yyy)] -> yyy | _ -> assert false
它不会匹配,因为 json 的类型是
val json : Yojson.Safe.json = `Assoc [("xxx", `Int 10000000000000)]