It seems Yojson returns Int if it fits in an OCaml int and `Intlit otherwise so you need to treat all the cases:
Int
int
`Intlit
match json with | `Assoc [("xxx", `Intlit lit)] -> Int64.of_string lit| `Assoc [("xxx", `Int i)] -> Int64.of_int i