Declarative JSON data manipulation for OCaml
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

ocaml-json: add section headers to Codec docs

+24
+24
lib/json.mli
··· 130 130 |> C.Object.seal 131 131 ]} *) 132 132 133 + (** {1:core Core types and diagnostics} *) 134 + 133 135 type 'a t = 'a Codec.t 134 136 (** The type of codecs mapping JSON values to OCaml values of type ['a]. *) 135 137 ··· 170 172 171 173 val with_doc : ?kind:string -> ?doc:string -> 'a t -> 'a t 172 174 (** [with_doc c] is [c] with updated [kind] and [doc] metadata. *) 175 + 176 + (** {1:scalars Scalar codecs} *) 173 177 174 178 module Base : sig 175 179 (** Low-level maps for custom scalar codecs. Most users can start with ··· 309 313 310 314 val binary_string : string t 311 315 (** Binary strings encoded as lower-case hexadecimal JSON strings. *) 316 + 317 + (** {1:arrays Array and tuple codecs} *) 312 318 313 319 module Array : sig 314 320 (** Low-level maps for custom JSON array representations. Prefer ··· 430 436 val tn : ?kind:string -> ?doc:string -> n:int -> 'a t -> 'a array t 431 437 (** JSON arrays with exactly [n] elements. *) 432 438 439 + (** {1:objects Object codecs} *) 440 + 433 441 module Object : sig 434 442 (** Builders for JSON object codecs. *) 435 443 ··· 593 601 (** Ignore JSON objects on decoding and encode an empty object. *) 594 602 end 595 603 604 + (** {1:mapping Choice, mapping, and recursion} *) 605 + 596 606 val any : 597 607 ?kind:string -> 598 608 ?doc:string -> ··· 635 645 636 646 val zero : unit t 637 647 (** Decode any JSON value to [()] and encode JSON null. *) 648 + 649 + (** {1:generic Generic AST codecs} *) 638 650 639 651 module Value : sig 640 652 (** Codecs for the generic {!Json.t} AST. *) ··· 664 676 (** Generic object members as an unknown-member map. *) 665 677 end 666 678 679 + (** {1:queries Query and update codecs} *) 680 + 667 681 val const : 'a t -> 'a -> 'a t 668 682 (** Decode any JSON value to a constant and encode that constant with [c]. *) 669 683 ··· 735 749 736 750 val delete_path : ?allow_absent:bool -> Path.t -> value t 737 751 (** Delete the value selected by a path. *) 752 + 753 + (** {1:runtime Runtime over {!Json.t}} *) 738 754 739 755 val decode : 'a t -> value -> ('a, Error.t) result 740 756 (** Apply a codec to an existing {!Json.t}. *) ··· 844 860 This is the AST layer for callers who need to keep, inspect, or construct 845 861 arbitrary JSON data. Prefer {!module-Json.Codec} when JSON should map 846 862 directly to ordinary OCaml values. *) 863 + 864 + (** {1:core Core JSON value types} *) 847 865 848 866 module Meta = Loc.Meta 849 867 (** JSON node metadata. *) ··· 889 907 val equal : t -> t -> bool 890 908 (** [equal a b] is [compare a b = 0]. *) 891 909 910 + (** {1:construct Constructors} *) 911 + 892 912 val null : unit cons 893 913 (** JSON null. *) 894 914 ··· 946 966 val member : name -> t -> member 947 967 (** [member n v] binds member name [n] to value [v]. *) 948 968 969 + (** {1:members Object-member queries} *) 970 + 949 971 val member_key : string -> member list -> member option 950 972 (** [member_key k mems] is the first member in [mems] whose key is [k], if 951 973 any. *) ··· 958 980 959 981 val zero : ?meta:Meta.t -> t -> t 960 982 (** The natural zero for a value's JSON sort. *) 983 + 984 + (** {1:printing Pretty-printing} *) 961 985 962 986 val pp_null : unit Fmt.t 963 987 (** Print JSON null. *)