File: safe_to_basic.ml

package info (click to toggle)
yojson 3.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,204 kB
  • sloc: ml: 3,436; makefile: 28
file content (6 lines) | stat: -rw-r--r-- 281 bytes parent folder | download
1
2
3
4
5
6
let rec to_basic : t -> Basic.t = function
  | (`Null | `Bool _ | `Int _ | `Float _ | `String _) as x -> x
  | `Intlit s -> `String s
  | `List l -> `List (List.rev (List.rev_map to_basic l))
  | `Assoc l ->
      `Assoc (List.rev (List.rev_map (fun (k, v) -> (k, to_basic v)) l))