Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Page
Library
Module
Module type
Parameter
Class
Class type
Source
json.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
open Bos_setup let from_string str = match Yojson.Basic.from_string str with | exception Yojson.Json_error msg -> R.error_msg msg | json -> Ok json let string_field ~field json = match Yojson.Basic.Util.member field json with | exception _ -> R.error_msgf "Could not find %S from:@ %a" field Yojson.Basic.pp json | `Null -> R.error_msgf "Could not find %S from:@ %a" field Yojson.Basic.pp json | `String s -> R.ok s | _ -> R.error_msgf "Cound not parse %S from:@ %a" field Yojson.Basic.pp json let int_field ~field json = match Yojson.Basic.Util.member field json with | exception _ -> R.error_msgf "Could not find %S from:@ %a" field Yojson.Basic.pp json | `Null -> R.error_msgf "Could not find %S from:@ %a" field Yojson.Basic.pp json | `Int i -> R.ok i | _ -> R.error_msgf "Could not parse %S from:@ %a" field Yojson.Basic.pp json