1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
type t =
{ name : string
; url : string option
}
let to_json { name; url } : Yojson.Basic.t =
`Assoc
(List.concat
[ [ "name", `String name ]
; (match url with
| None -> []
| Some u -> [ "url", `String u ])
])
;;