if my structure is
{ :a :A
:b :B
:c {
:d :D
}
:e {
:f {
:g :G
:h :H
}
}
}
I
You can build this with clojure.zip or tree-seq fairly easily though I strongly prefer the prismatic.schema library for verifying the structure of nested maps
user> (def my-data-format
{:a Keyword
:b Keyword
:c {:d Keyword}
:e {:f {:g Keyword
:h Keyword}}})
#'user/my-data-format
user> (def some-data
{:a :A
:b :B
:c {:d :D}
:e {:f {:g :G
:h :G}}})
#'user/some-data
user> (schema/validate my-data-format some-data)
{:a :A, :c {:d :D}, :b :B, :e {:f {:g :G, :h :G}}}
user> (def some-wrong-data
{:a :A
:b :B
:c {:wrong :D}
:e {:f {:g :G
:h :G}}})
#'user/some-wrong-data
user> (schema/validate my-data-format some-wrong-data)
ExceptionInfo Value does not match schema:
{:c {:d missing-required-key,
:wrong disallowed-key}}
schema.core/validate (core.clj:132)