{"action":"opened","issue":{"url":"https://api.github.com/repos/json4s/json4s/issues/564","repository_url":"https://api.github.com/repos/json4s/json4s","labels_url":"https://api.github.com/repos/json4s/json4s/issues/564/labels{/name}","comments_url":"https://api.github.com/repos/json4s/json4s/issues/564/comments","events_url":"https://api.github.com/repos/json4s/json4s/issues/564/events","html_url":"https://github.com/json4s/json4s/issues/564","id":388818967,"node_id":"MDU6SXNzdWUzODg4MTg5Njc=","number":564,"title":"Deserialized inner case classes cannot be compared with case classes initialized in code","user":{"login":"svenallers","id":7449886,"node_id":"MDQ6VXNlcjc0NDk4ODY=","avatar_url":"https://avatars3.githubusercontent.com/u/7449886?v=4","gravatar_id":"","url":"https://api.github.com/users/svenallers","html_url":"https://github.com/svenallers","followers_url":"https://api.github.com/users/svenallers/followers","following_url":"https://api.github.com/users/svenallers/following{/other_user}","gists_url":"https://api.github.com/users/svenallers/gists{/gist_id}","starred_url":"https://api.github.com/users/svenallers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/svenallers/subscriptions","organizations_url":"https://api.github.com/users/svenallers/orgs","repos_url":"https://api.github.com/users/svenallers/repos","events_url":"https://api.github.com/users/svenallers/events{/privacy}","received_events_url":"https://api.github.com/users/svenallers/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-12-07T21:24:01Z","updated_at":"2018-12-07T21:24:01Z","closed_at":null,"author_association":"NONE","body":"When deserializing case classes that are defined inside of a class then those cannot be compared with objects of the same class that were initialized in code.\r\n\r\nExample:\r\n```\r\nimport org.json4s.{DefaultFormats, Formats}\r\nimport org.json4s.native.JsonMethods\r\nimport org.scalatest.{Matchers, WordSpec}\r\n\r\nclass MySpec extends WordSpec with Matchers{\r\n  implicit val implicitFormats: Formats = DefaultFormats\r\n\r\n  \"This test fails\" in {\r\n    val json = JsonMethods.parse(\"\"\"{\r\n      |  \"id\": \"1234\"\r\n      |}\r\n    \"\"\".stripMargin)\r\n    \r\n    val model = json.extract[MyModel]\r\n    model.id shouldBe \"1234\" //This check still works\r\n    model shouldBe MyModel(\"1234\") //This check fails\r\n  }\r\n\r\n  case class MyModel(id: String)\r\n}\r\n```\r\n\r\nI fixed it for me by defining the case classes outside of the class. But I still think that this is a bug and should be fixed.\r\n\r\n### json4s version\r\n3.6.2\r\n\r\n### scala version\r\n2.12.8\r\n\r\n### jdk version\r\n1.8.0_191"}}
{"actor":{"display_login":"svenallers"}}