|
@@ -133,7 +133,7 @@ structure JSONUtil : sig
|
|
|
|
|
|
fun lookupField (v as J.OBJECT fields) = let
|
|
fun lookupField (v as J.OBJECT fields) = let
|
|
fun find lab = (case List.find (fn (l, v) => (l = lab)) fields
|
|
fun find lab = (case List.find (fn (l, v) => (l = lab)) fields
|
|
- of NONE => raise FieldNotFound(v, concat["no definition for field \"", lab, "\""])
|
|
|
|
|
|
+ of NONE => raise FieldNotFound(v, lab)
|
|
| SOME(_, v) => v
|
|
| SOME(_, v) => v
|
|
(* end case *))
|
|
(* end case *))
|
|
in
|
|
in
|
|
@@ -197,7 +197,7 @@ structure JSONUtil : sig
|
|
fun get (v, []) = v
|
|
fun get (v, []) = v
|
|
| get (v as J.OBJECT fields, SEL lab :: rest) =
|
|
| get (v as J.OBJECT fields, SEL lab :: rest) =
|
|
(case List.find (fn (l, v) => (l = lab)) fields
|
|
(case List.find (fn (l, v) => (l = lab)) fields
|
|
- of NONE => raise raise FieldNotFound(v, concat["no definition for field \"", lab, "\""])
|
|
|
|
|
|
+ of NONE => raise FieldNotFound(v, lab)
|
|
| SOME(_, v) => get (v, rest)
|
|
| SOME(_, v) => get (v, rest)
|
|
(* end case *))
|
|
(* end case *))
|
|
| get (v, SEL _ :: _) = raise NotObject v
|
|
| get (v, SEL _ :: _) = raise NotObject v
|
|
@@ -222,7 +222,7 @@ structure JSONUtil : sig
|
|
(* follow a path into a JSON value while constructing a zipper *)
|
|
(* follow a path into a JSON value while constructing a zipper *)
|
|
fun unzip (v, []) = (ZNIL, v)
|
|
fun unzip (v, []) = (ZNIL, v)
|
|
| unzip (v as J.OBJECT fields, SEL lab :: rest) = let
|
|
| unzip (v as J.OBJECT fields, SEL lab :: rest) = let
|
|
- fun find (_, []) = raise FieldNotFound(v, concat["no definition for field \"", lab, "\""])
|
|
|
|
|
|
+ fun find (_, []) = raise FieldNotFound(v, lab)
|
|
| find (pre, (l, v)::flds) = if (l = lab)
|
|
| find (pre, (l, v)::flds) = if (l = lab)
|
|
then let
|
|
then let
|
|
val (zipper, v) = unzip (v, rest)
|
|
val (zipper, v) = unzip (v, rest)
|