title: How to resolve recursive decoding in Circe when parsing Json?
body: <p>I want to parse a JSON string using Circa. You can find an example of the input JSON below.</p>
  
  <p>It's a kind of recursive data. So my property <code>entity</code> contains dependencies of entities. </p>
  
  <p>I want to parse dependencies to map <code>Map[String, Tasks]</code>.</p>
  
  <pre><code>{
    "entity": [
      {
        "task_id": "X",
        "type": "test",
        "attributes": {
          "name": "A",
          "random_property_count": 1 // should be ignored
        },
        "dependencies": {
          "random_name_1": {
            "entity": [
              {
                "task_id": "907544AF",
                "type": "test",
                "attributes": {
                  "name": "B",
                  "random_attribute": "*"
                },
                "dependencies": {
                  "random_name_2": {
                    "entity": [
                      {
                        "task_id": "5",
                        "random_prop": "...",  // should be ignored as it's not present in model
                        "type": "test",
                        "attributes": {
                          "name": "C"
                        }
                      }
                    ]
                  }
                }
              }
            ]
          }
        }
      }
    ]
  }
  </code></pre>
  
  <p>Here is my code:</p>
  
  <pre><code>  case class Tasks (entity: Seq[Task])
    case class Task(task_id: String, `type`: String, attributes: Attributes, dependencies: Map[String, Tasks])
    case class Attributes(name: String)
  
    implicit val decodeTask: Decoder[Task] = deriveDecoder[Task]
    implicit val decodeTasks: Decoder[Tasks] = deriveDecoder[Tasks]
    implicit val decodeAttributes: Decoder[Attributes] = deriveDecoder[Attributes]
  
    val json = fromInputStream(getClass.getResourceAsStream("/json/example.json")).getLines.mkString
    val tasks = decode[Tasks](json)
  
    tasks match {
      case Left(failure) =&gt; println(failure)
      case Right(json)   =&gt; println(json)
    }
  </code></pre>
  
  <p>When I try to parse JSON string to my model, I get an error like this:</p>
  
  <pre><code>DecodingFailure(Attempt to decode value on failed cursor, List(DownField(dependencies), DownArray, DownField(entity), DownField(random_name_2), DownField(dependencies), DownArray, DownField(entity), DownField(random_name_1), DownField(dependencies), DownArray, DownField(entity)))
  </code></pre>
  
  <p>What can be the issue?</p>