title: Clojure: How to collapse nested maps with a specific key?
body: <p>I'm trying to clean up some JSON data in Clojure. Some values in the JSON document are encapsulated in objects with associated (and no longer needed) metadata. I start with a JSON document like:</p>
  
  <pre><code>{ "household": {
      "address": {
          "street": { "value": "123 Fire Ln", "foo": "bar1" },
          "zip": { "value": "01234", "foo": "bar2" }
      },
      "persons": [
          {
              "id": "0001",
              "name": { "value": "John Smith", "foo": "bar3" }
          },
          {
              "id": "0002",
              "name": { "value": "Jane Smith", "foo": "bar4" }
          }
      ]
  } }
  </code></pre>
  
  <p>Using Cheshire I parse this JSON and get the following data structure:</p>
  
  <pre><code>{ "household" {
      "address" {
          "street" {"value" "123 Fire Ln", "foo" "bar1"},
          "zip" {"value" "01234", "foo" "bar2"}
      },
      "persons" [
          {"id" "0001", "name" {"value" "John Smith", "foo" "bar3"}}
          {"id" "0002", "name" {"value" "Jane Smith", "foo" "bar4"}}
      ]
  } }
  </code></pre>
  
  <p>My goal is to "collapse" those nested maps with a "value" key, drop the "foo" assoc, and assign the value to the map key one level higher (e.g., "street", "zip", "name"). The resulting data structure would look like:</p>
  
  <pre><code>{ "household" {
      "address" {
          "street" "123 Fire Ln",
          "zip" "01234"
      },
      "persons" [
          {"id" "0001", "name" "John Smith"}
          {"id" "0002", "name" "Jane Smith"}
      ]
  } }
  </code></pre>
  
  <p>Any help here would be wonderful, thanks!</p>