plokhotnyuk / jsoniter-scala

Scala macros for compile-time generation of safe and ultra-fast JSON codecs + circe booster
MIT License
744 stars 99 forks source link

Strange ClassCastException #104

Closed hntd187 closed 6 years ago

hntd187 commented 6 years ago

Hi, I'm trying to use this library to derive encoders for the crossref API.

Exception in thread "main" java.lang.ClassCastException: java.lang.Integer cannot be cast to scala.collection.Seq

is the error I get.

The JSON coming back is

{
  "status": "ok",
  "message-type": "work-list",
  "message-version": "1.0.0",
  "message": {
    "facets": {},
    "next-cursor": "AoJws87kpN8CPzJodHRwOi8vZHguZG9pLm9yZy8xMC4xMDAyLyhzaWNpKTEwOTctMDMyMCgxOTk5MTAxNSkzODo1PDI1Njo6YWlkLWN5dG85PjMuMC5jbzsyLWI=",
    "total-results": 96089014,
    "items": [
      {
        "indexed": {
          "date-parts": [
            [
              2017,
              10,
              23
            ]
          ],
          "date-time": "2017-10-23T14:10:54Z",
          "timestamp": 1508767854795
        },
        "reference-count": 0,
        "publisher": "Wiley-Blackwell",
        "issue": "1-2",
        "license": [
          {
            "URL": "http:\/\/doi.wiley.com\/10.1002\/tdm_license_1.1",
            "start": {
              "date-parts": [
                [
                  2015,
                  9,
                  1
                ]
              ],
              "date-time": "2015-09-01T00:00:00Z",
              "timestamp": 1441065600000
            },
            "delay-in-days": 6087,
            "content-version": "tdm"
          }
        ],
        "content-domain": {
          "domain": [],
          "crossmark-restriction": false
        },
        "short-container-title": [
          "Geol. J."
        ],
        "published-print": {
          "date-parts": [
            [
              1999,
              1
            ]
          ]
        },
        "DOI": "10.1002\/(sici)1099-1034(199901\/06)34:1\/2<3::aid-gj811>3.0.co;2-7",
        "type": "journal-article",
        "created": {
          "date-parts": [
            [
              2002,
              8,
              25
            ]
          ],
          "date-time": "2002-08-25T21:18:31Z",
          "timestamp": 1030310311000
        },
        "page": "3-5",
        "source": "Crossref",
        "is-referenced-by-count": 0,
        "title": [
          "Preface"
        ],
        "prefix": "10.1002",
        "volume": "34",
        "member": "311",
        "container-title": [
          "Geological Journal"
        ],
        "link": [
          {
            "URL": "https:\/\/api.wiley.com\/onlinelibrary\/tdm\/v1\/articles\/10.1002%2F(SICI)1099-1034(199901%2F06)34:1%2F2%3C3::AID-GJ811%3E3.0.CO;2-7",
            "content-type": "unspecified",
            "content-version": "vor",
            "intended-application": "text-mining"
          }
        ],
        "deposited": {
          "date-parts": [
            [
              2017,
              4,
              4
            ]
          ],
          "date-time": "2017-04-04T23:25:54Z",
          "timestamp": 1491348354000
        },
        "score": 1.0,
        "issued": {
          "date-parts": [
            [
              1999,
              1
            ]
          ]
        },
        "references-count": 0,
        "journal-issue": {
          "issue": "1-2"
        },
        "URL": "http:\/\/dx.doi.org\/10.1002\/(sici)1099-1034(199901\/06)34:1\/2<3::aid-gj811>3.0.co;2-7",
        "ISSN": [
          "0072-1050",
          "1099-1034"
        ],
        "issn-type": [
          {
            "value": "0072-1050",
            "type": "print"
          },
          {
            "value": "1099-1034",
            "type": "electronic"
          }
        ],
        "subject": [
          "Geology"
        ]
      },
      {
        "indexed": {
          "date-parts": [
            [
              2017,
              10,
              23
            ]
          ],
          "date-time": "2017-10-23T14:10:54Z",
          "timestamp": 1508767854921
        },
        "reference-count": 0,
        "publisher": "World Scientific Pub Co Pte Lt",
        "issue": "1",
        "content-domain": {
          "domain": [],
          "crossmark-restriction": false
        },
        "short-container-title": [
          "J. Porphyrins Phthalocyanines"
        ],
        "published-print": {
          "date-parts": [
            [
              2000,
              1
            ]
          ]
        },
        "DOI": "10.1002\/(sici)1099-1409(200001\/02)4:1<123::aid-jpp211>3.3.co;2-q",
        "type": "journal-article",
        "created": {
          "date-parts": [
            [
              2002,
              8,
              25
            ]
          ],
          "date-time": "2002-08-25T21:18:31Z",
          "timestamp": 1030310311000
        },
        "page": "123-128",
        "source": "Crossref",
        "is-referenced-by-count": 0,
        "title": [
          "Photoreduction of methylviologen sensitized by amphiphilic phthalocyanatozinc(II) complexes"
        ],
        "prefix": "10.1142",
        "volume": "4",
        "member": "219",
        "container-title": [
          "Journal of Porphyrins and Phthalocyanines"
        ],
        "deposited": {
          "date-parts": [
            [
              2007,
              2,
              13
            ]
          ],
          "date-time": "2007-02-13T20:56:13Z",
          "timestamp": 1171400173000
        },
        "score": 1.0,
        "issued": {
          "date-parts": [
            [
              2000,
              1
            ]
          ]
        },
        "references-count": 0,
        "journal-issue": {
          "issue": "1"
        },
        "URL": "http:\/\/dx.doi.org\/10.1002\/(sici)1099-1409(200001\/02)4:1<123::aid-jpp211>3.3.co;2-q",
        "ISSN": [
          "1088-4246",
          "1099-1409"
        ],
        "issn-type": [
          {
            "value": "1088-4246",
            "type": "print"
          },
          {
            "value": "1099-1409",
            "type": "electronic"
          }
        ],
        "subject": [
          "General Chemistry"
        ]
      },
      {
        "indexed": {
          "date-parts": [
            [
              2017,
              10,
              23
            ]
          ],
          "date-time": "2017-10-23T14:10:54Z",
          "timestamp": 1508767854940
        },
        "reference-count": 0,
        "publisher": "World Scientific Pub Co Pte Lt",
        "issue": "1",
        "content-domain": {
          "domain": [],
          "crossmark-restriction": false
        },
        "short-container-title": [
          "J. Porphyrins Phthalocyanines"
        ],
        "published-print": {
          "date-parts": [
            [
              2000,
              1
            ]
          ]
        },
        "DOI": "10.1002\/(sici)1099-1409(200001\/02)4:1<45::aid-jpp195>3.3.co;2-d",
        "type": "journal-article",
        "created": {
          "date-parts": [
            [
              2002,
              8,
              25
            ]
          ],
          "date-time": "2002-08-25T18:02:53Z",
          "timestamp": 1030298573000
        },
        "page": "45-64",
        "source": "Crossref",
        "is-referenced-by-count": 0,
        "title": [
          "Synthesis and structure of vinylporphyrin metal complexes and their copolymerization. Spectral luminescence properties of Zn copolymers in solution"
        ],
        "prefix": "10.1142",
        "volume": "4",
        "member": "219",
        "container-title": [
          "Journal of Porphyrins and Phthalocyanines"
        ],
        "deposited": {
          "date-parts": [
            [
              2007,
              2,
              13
            ]
          ],
          "date-time": "2007-02-13T20:56:13Z",
          "timestamp": 1171400173000
        },
        "score": 1.0,
        "issued": {
          "date-parts": [
            [
              2000,
              1
            ]
          ]
        },
        "references-count": 0,
        "journal-issue": {
          "issue": "1"
        },
        "URL": "http:\/\/dx.doi.org\/10.1002\/(sici)1099-1409(200001\/02)4:1<45::aid-jpp195>3.3.co;2-d",
        "ISSN": [
          "1088-4246",
          "1099-1409"
        ],
        "issn-type": [
          {
            "value": "1088-4246",
            "type": "print"
          },
          {
            "value": "1099-1409",
            "type": "electronic"
          }
        ],
        "subject": [
          "General Chemistry"
        ]
      },
      {
        "indexed": {
          "date-parts": [
            [
              2017,
              10,
              23
            ]
          ],
          "date-time": "2017-10-23T14:10:54Z",
          "timestamp": 1508767854959
        },
        "reference-count": 0,
        "publisher": "World Scientific Pub Co Pte Lt",
        "issue": "1",
        "content-domain": {
          "domain": [],
          "crossmark-restriction": false
        },
        "short-container-title": [
          "J. Porphyrins Phthalocyanines"
        ],
        "published-print": {
          "date-parts": [
            [
              2000,
              1
            ]
          ]
        },
        "DOI": "10.1002\/(sici)1099-1409(200001\/02)4:1<19::aid-jpp161>3.3.co;2-j",
        "type": "journal-article",
        "created": {
          "date-parts": [
            [
              2002,
              8,
              25
            ]
          ],
          "date-time": "2002-08-25T21:18:31Z",
          "timestamp": 1030310311000
        },
        "page": "19-22",
        "source": "Crossref",
        "is-referenced-by-count": 0,
        "title": [
          "Oxygen sensing using palladium porphyrin with long alkyl chain self\u2010assembled film"
        ],
        "prefix": "10.1142",
        "volume": "4",
        "member": "219",
        "container-title": [
          "Journal of Porphyrins and Phthalocyanines"
        ],
        "deposited": {
          "date-parts": [
            [
              2007,
              2,
              13
            ]
          ],
          "date-time": "2007-02-13T20:56:13Z",
          "timestamp": 1171400173000
        },
        "score": 1.0,
        "issued": {
          "date-parts": [
            [
              2000,
              1
            ]
          ]
        },
        "references-count": 0,
        "journal-issue": {
          "issue": "1"
        },
        "URL": "http:\/\/dx.doi.org\/10.1002\/(sici)1099-1409(200001\/02)4:1<19::aid-jpp161>3.3.co;2-j",
        "ISSN": [
          "1088-4246",
          "1099-1409"
        ],
        "issn-type": [
          {
            "value": "1088-4246",
            "type": "print"
          },
          {
            "value": "1099-1409",
            "type": "electronic"
          }
        ],
        "subject": [
          "General Chemistry"
        ]
      },
      {
        "indexed": {
          "date-parts": [
            [
              2017,
              10,
              23
            ]
          ],
          "date-time": "2017-10-23T14:10:55Z",
          "timestamp": 1508767855096
        },
        "reference-count": 0,
        "publisher": "Wiley-Blackwell",
        "issue": "2",
        "license": [
          {
            "URL": "http:\/\/doi.wiley.com\/10.1002\/tdm_license_1.1",
            "start": {
              "date-parts": [
                [
                  2015,
                  9,
                  1
                ]
              ],
              "date-time": "2015-09-01T00:00:00Z",
              "timestamp": 1441065600000
            },
            "delay-in-days": 6087,
            "content-version": "tdm"
          }
        ],
        "content-domain": {
          "domain": [],
          "crossmark-restriction": false
        },
        "short-container-title": [
          "Comp. Int. Rev."
        ],
        "published-print": {
          "date-parts": [
            [
              1999
            ]
          ]
        },
        "DOI": "10.1002\/(sici)1520-6386(199932)10:2<86::aid-cir10>3.0.co;2-m",
        "type": "journal-article",
        "created": {
          "date-parts": [
            [
              2002,
              8,
              25
            ]
          ],
          "date-time": "2002-08-25T21:33:58Z",
          "timestamp": 1030311238000
        },
        "page": "86-89",
        "source": "Crossref",
        "is-referenced-by-count": 0,
        "title": [
          "Book reviews"
        ],
        "prefix": "10.1002",
        "volume": "10",
        "member": "311",
        "container-title": [
          "Competitive Intelligence Review"
        ],
        "link": [
          {
            "URL": "https:\/\/api.wiley.com\/onlinelibrary\/tdm\/v1\/articles\/10.1002%2F(SICI)1520-6386(199932)10:2%3C86::AID-CIR10%3E3.0.CO;2-M",
            "content-type": "unspecified",
            "content-version": "vor",
            "intended-application": "text-mining"
          }
        ],
        "deposited": {
          "date-parts": [
            [
              2017,
              4,
              4
            ]
          ],
          "date-time": "2017-04-04T23:42:43Z",
          "timestamp": 1491349363000
        },
        "score": 1.0,
        "issued": {
          "date-parts": [
            [
              1999
            ]
          ]
        },
        "references-count": 0,
        "journal-issue": {
          "issue": "2"
        },
        "URL": "http:\/\/dx.doi.org\/10.1002\/(sici)1520-6386(199932)10:2<86::aid-cir10>3.0.co;2-m",
        "ISSN": [
          "1058-0247",
          "1520-6386"
        ],
        "issn-type": [
          {
            "value": "1058-0247",
            "type": "print"
          },
          {
            "value": "1520-6386",
            "type": "electronic"
          }
        ]
      },
      {
        "indexed": {
          "date-parts": [
            [
              2017,
              10,
              23
            ]
          ],
          "date-time": "2017-10-23T14:10:55Z",
          "timestamp": 1508767855119
        },
        "reference-count": 0,
        "publisher": "Wiley-Blackwell",
        "issue": "1",
        "license": [
          {
            "URL": "http:\/\/doi.wiley.com\/10.1002\/tdm_license_1.1",
            "start": {
              "date-parts": [
                [
                  2015,
                  9,
                  1
                ]
              ],
              "date-time": "2015-09-01T00:00:00Z",
              "timestamp": 1441065600000
            },
            "delay-in-days": 6087,
            "content-version": "tdm"
          }
        ],
        "content-domain": {
          "domain": [],
          "crossmark-restriction": false
        },
        "short-container-title": [
          "Comp. Int. Rev."
        ],
        "published-print": {
          "date-parts": [
            [
              1999,
              1
            ]
          ]
        },
        "DOI": "10.1002\/(sici)1520-6386(199931)10:1<88::aid-cir13>3.0.co;2-f",
        "type": "journal-article",
        "created": {
          "date-parts": [
            [
              2002,
              8,
              25
            ]
          ],
          "date-time": "2002-08-25T16:58:46Z",
          "timestamp": 1030294726000
        },
        "page": "88-88",
        "source": "Crossref",
        "is-referenced-by-count": 0,
        "title": [
          "Book reviews"
        ],
        "prefix": "10.1002",
        "volume": "10",
        "member": "311",
        "published-online": {
          "date-parts": [
            [
              2001,
              1,
              3
            ]
          ]
        },
        "container-title": [
          "Competitive Intelligence Review"
        ],
        "link": [
          {
            "URL": "https:\/\/api.wiley.com\/onlinelibrary\/tdm\/v1\/articles\/10.1002%2F(SICI)1520-6386(199931)10:1%3C88::AID-CIR13%3E3.0.CO;2-F",
            "content-type": "unspecified",
            "content-version": "vor",
            "intended-application": "text-mining"
          }
        ],
        "deposited": {
          "date-parts": [
            [
              2017,
              4,
              4
            ]
          ],
          "date-time": "2017-04-04T23:25:54Z",
          "timestamp": 1491348354000
        },
        "score": 1.0,
        "issued": {
          "date-parts": [
            [
              1999,
              1
            ]
          ]
        },
        "references-count": 0,
        "journal-issue": {
          "issue": "1"
        },
        "URL": "http:\/\/dx.doi.org\/10.1002\/(sici)1520-6386(199931)10:1<88::aid-cir13>3.0.co;2-f",
        "ISSN": [
          "1058-0247"
        ],
        "issn-type": [
          {
            "value": "1058-0247",
            "type": "print"
          }
        ]
      },
      {
        "indexed": {
          "date-parts": [
            [
              2017,
              10,
              23
            ]
          ],
          "date-time": "2017-10-23T14:10:55Z",
          "timestamp": 1508767855151
        },
        "reference-count": 0,
        "publisher": "Wiley-Blackwell",
        "issue": "2",
        "license": [
          {
            "URL": "http:\/\/doi.wiley.com\/10.1002\/tdm_license_1.1",
            "start": {
              "date-parts": [
                [
                  2015,
                  9,
                  1
                ]
              ],
              "date-time": "2015-09-01T00:00:00Z",
              "timestamp": 1441065600000
            },
            "delay-in-days": 6087,
            "content-version": "tdm"
          }
        ],
        "content-domain": {
          "domain": [],
          "crossmark-restriction": false
        },
        "short-container-title": [
          "Comp. Int. Rev."
        ],
        "published-print": {
          "date-parts": [
            [
              1999
            ]
          ]
        },
        "DOI": "10.1002\/(sici)1520-6386(199932)10:2<91::aid-cir12>3.0.co;2-i",
        "type": "journal-article",
        "created": {
          "date-parts": [
            [
              2002,
              8,
              25
            ]
          ],
          "date-time": "2002-08-25T17:21:07Z",
          "timestamp": 1030296067000
        },
        "page": "91-92",
        "source": "Crossref",
        "is-referenced-by-count": 0,
        "title": [
          "Competitive Intelligence library"
        ],
        "prefix": "10.1002",
        "volume": "10",
        "member": "311",
        "container-title": [
          "Competitive Intelligence Review"
        ],
        "link": [
          {
            "URL": "https:\/\/api.wiley.com\/onlinelibrary\/tdm\/v1\/articles\/10.1002%2F(SICI)1520-6386(199932)10:2%3C91::AID-CIR12%3E3.0.CO;2-I",
            "content-type": "unspecified",
            "content-version": "vor",
            "intended-application": "text-mining"
          }
        ],
        "deposited": {
          "date-parts": [
            [
              2017,
              4,
              4
            ]
          ],
          "date-time": "2017-04-04T23:43:26Z",
          "timestamp": 1491349406000
        },
        "score": 1.0,
        "issued": {
          "date-parts": [
            [
              1999
            ]
          ]
        },
        "references-count": 0,
        "journal-issue": {
          "issue": "2"
        },
        "URL": "http:\/\/dx.doi.org\/10.1002\/(sici)1520-6386(199932)10:2<91::aid-cir12>3.0.co;2-i",
        "ISSN": [
          "1058-0247",
          "1520-6386"
        ],
        "issn-type": [
          {
            "value": "1058-0247",
            "type": "print"
          },
          {
            "value": "1520-6386",
            "type": "electronic"
          }
        ]
      },
      {
        "indexed": {
          "date-parts": [
            [
              2017,
              10,
              23
            ]
          ],
          "date-time": "2017-10-23T14:10:55Z",
          "timestamp": 1508767855175
        },
        "reference-count": 0,
        "publisher": "Wiley-Blackwell",
        "issue": "1",
        "license": [
          {
            "URL": "http:\/\/doi.wiley.com\/10.1002\/tdm_license_1.1",
            "start": {
              "date-parts": [
                [
                  2015,
                  9,
                  1
                ]
              ],
              "date-time": "2015-09-01T00:00:00Z",
              "timestamp": 1441065600000
            },
            "delay-in-days": 5722,
            "content-version": "tdm"
          }
        ],
        "content-domain": {
          "domain": [],
          "crossmark-restriction": false
        },
        "short-container-title": [
          "J. Int. Dev."
        ],
        "published-print": {
          "date-parts": [
            [
              2000,
              1
            ]
          ]
        },
        "DOI": "10.1002\/(sici)1099-1328(200001)12:1<145::aid-jid646>3.0.co;2-7",
        "type": "journal-article",
        "created": {
          "date-parts": [
            [
              2002,
              8,
              25
            ]
          ],
          "date-time": "2002-08-25T21:18:31Z",
          "timestamp": 1030310311000
        },
        "page": "145-146",
        "source": "Crossref",
        "is-referenced-by-count": 0,
        "title": [
          "Book review: Decentralised Production in India: Industrial Districts, Flexible Specialisation and Employment by Philippe Cadene and Mark Holmstrom (eds). (New Delhi and London: Sage, 1998, pp. 413)."
        ],
        "prefix": "10.1002",
        "volume": "12",
        "member": "311",
        "container-title": [
          "Journal of International Development"
        ],
        "link": [
          {
            "URL": "https:\/\/api.wiley.com\/onlinelibrary\/tdm\/v1\/articles\/10.1002%2F(SICI)1099-1328(200001)12:1%3C145::AID-JID646%3E3.0.CO;2-7",
            "content-type": "unspecified",
            "content-version": "vor",
            "intended-application": "text-mining"
          }
        ],
        "deposited": {
          "date-parts": [
            [
              2017,
              4,
              4
            ]
          ],
          "date-time": "2017-04-04T11:32:20Z",
          "timestamp": 1491305540000
        },
        "score": 1.0,
        "issued": {
          "date-parts": [
            [
              2000,
              1
            ]
          ]
        },
        "references-count": 0,
        "journal-issue": {
          "issue": "1"
        },
        "URL": "http:\/\/dx.doi.org\/10.1002\/(sici)1099-1328(200001)12:1<145::aid-jid646>3.0.co;2-7",
        "ISSN": [
          "0954-1748",
          "1099-1328"
        ],
        "issn-type": [
          {
            "value": "0954-1748",
            "type": "print"
          },
          {
            "value": "1099-1328",
            "type": "electronic"
          }
        ],
        "subject": [
          "Geography, Planning and Development",
          "Development"
        ]
      },
      {
        "indexed": {
          "date-parts": [
            [
              2017,
              10,
              23
            ]
          ],
          "date-time": "2017-10-23T14:10:55Z",
          "timestamp": 1508767855188
        },
        "reference-count": 16,
        "publisher": "Wiley-Blackwell",
        "issue": "3",
        "license": [
          {
            "URL": "http:\/\/doi.wiley.com\/10.1002\/tdm_license_1.1",
            "start": {
              "date-parts": [
                [
                  2015,
                  9,
                  1
                ]
              ],
              "date-time": "2015-09-01T00:00:00Z",
              "timestamp": 1441065600000
            },
            "delay-in-days": 6087,
            "content-version": "tdm"
          }
        ],
        "content-domain": {
          "domain": [],
          "crossmark-restriction": false
        },
        "short-container-title": [
          "Comp. Int. Rev."
        ],
        "published-print": {
          "date-parts": [
            [
              1999
            ]
          ]
        },
        "DOI": "10.1002\/(sici)1520-6386(199933)10:3<51::aid-cir8>3.0.co;2-a",
        "type": "journal-article",
        "created": {
          "date-parts": [
            [
              2002,
              8,
              25
            ]
          ],
          "date-time": "2002-08-25T21:33:58Z",
          "timestamp": 1030311238000
        },
        "page": "51-57",
        "source": "Crossref",
        "is-referenced-by-count": 0,
        "title": [
          "The six angles of competition"
        ],
        "prefix": "10.1002",
        "volume": "10",
        "member": "311",
        "reference": [
          {
            "key": "10.1002\/(SICI)1520-6386(199933)10:3<51::AID-CIR8>3.0.CO;2-A-BIB1",
            "author": "Altshuller",
            "year": "1997",
            "unstructured": "(1997). 40 Principles\u2014TRIZ keys to technical innovation. In L. Shulyak & S. Rodman (Trans.) Worcester: Technical Innovations Center, Inc. (Original work published in 1974)",
            "volume-title": "L. Shulyak & S. Rodman"
          },
          {
            "key": "10.1002\/(SICI)1520-6386(199933)10:3<51::AID-CIR8>3.0.CO;2-A-BIB2",
            "author": "Brandenburger",
            "year": "1996",
            "unstructured": "& (1996). Co-opetition. New York: Doubleday.",
            "volume-title": "Co-opetition"
          },
          {
            "key": "10.1002\/(SICI)1520-6386(199933)10:3<51::AID-CIR8>3.0.CO;2-A-BIB3",
            "author": "Barker",
            "year": "1992",
            "unstructured": "(1992). Paradigms. New York: Harper Business.",
            "volume-title": "Paradigms"
          },
          {
            "key": "10.1002\/(SICI)1520-6386(199933)10:3<51::AID-CIR8>3.0.CO;2-A-BIB4",
            "author": "Barry",
            "year": "1996",
            "unstructured": "(1996). Creating a financial services industry for the 21st century, part 1: Tear down the walls. Talking Points No.14. The Heritage Foundation [On-line]. Available: http:\\\\\\www.heritage.org\/library\/categories\/regulation\/tp.14.html"
          },
          {
            "key": "10.1002\/(SICI)1520-6386(199933)10:3<51::AID-CIR8>3.0.CO;2-A-BIB5",
            "author": "Cantrell",
            "year": "1996",
            "unstructured": "(1996). Patent intelligence\u2014 Information to compete before products are launched. Competitive Intelligence Review, 1, 65-69."
          },
          {
            "key": "10.1002\/(SICI)1520-6386(199933)10:3<51::AID-CIR8>3.0.CO;2-A-BIB6",
            "author": "Cantrell",
            "year": "1999",
            "unstructured": "(1999). The man who made boats. Manuscript submitted for publication."
          },
          {
            "key": "10.1002\/(SICI)1520-6386(199933)10:3<51::AID-CIR8>3.0.CO;2-A-BIB7",
            "year": "1964",
            "unstructured": "Derwent Information. (1964-1998). Derwent world patents index and Derwent patent citations index. London: Derwent Information."
          },
          {
            "key": "10.1002\/(SICI)1520-6386(199933)10:3<51::AID-CIR8>3.0.CO;2-A-BIB8",
            "author": "Dixit",
            "year": "1991",
            "unstructured": "& (1991). Thinking strategically. New York: W.W. Norton & Co.",
            "volume-title": "Thinking strategically"
          },
          {
            "key": "10.1002\/(SICI)1520-6386(199933)10:3<51::AID-CIR8>3.0.CO;2-A-BIB9",
            "author": "Dolan",
            "year": "1996",
            "unstructured": "& (1996). Power pricing. New York: Free Press.",
            "volume-title": "Power pricing"
          },
          {
            "key": "10.1002\/(SICI)1520-6386(199933)10:3<51::AID-CIR8>3.0.CO;2-A-BIB10",
            "author": "Gleick",
            "year": "1987",
            "unstructured": "(1987). Chaos. New York: Penguin Books.",
            "volume-title": "Chaos"
          },
          {
            "key": "10.1002\/(SICI)1520-6386(199933)10:3<51::AID-CIR8>3.0.CO;2-A-BIB11",
            "author": "Klavans",
            "year": "1997",
            "unstructured": "(1997). Identifying the research underlying technical competitive intelligence: Keeping abreast of science and technology. Ohio: Battelle Memorial Institute.",
            "volume-title": "Identifying the research underlying technical competitive intelligence: Keeping abreast of science and technology"
          },
          {
            "key": "10.1002\/(SICI)1520-6386(199933)10:3<51::AID-CIR8>3.0.CO;2-A-BIB12",
            "author": "Mann",
            "year": "1999",
            "unstructured": "(1999). Programs to the people. Technology Review 102(1), 36-42."
          },
          {
            "key": "10.1002\/(SICI)1520-6386(199933)10:3<51::AID-CIR8>3.0.CO;2-A-BIB13",
            "author": "Porter",
            "year": "1985",
            "unstructured": "(1985). Competitive advantage: Creating and sustaining superior performance. New York: The Free Press.",
            "volume-title": "Competitive advantage: Creating and sustaining superior performance"
          },
          {
            "key": "10.1002\/(SICI)1520-6386(199933)10:3<51::AID-CIR8>3.0.CO;2-A-BIB14",
            "author": "Slowotzky",
            "year": "1996",
            "unstructured": "(1996). Value migration. Boston: Harvard Business Press.",
            "volume-title": "Value migration"
          },
          {
            "key": "10.1002\/(SICI)1520-6386(199933)10:3<51::AID-CIR8>3.0.CO;2-A-BIB15",
            "unstructured": "WebPhone. Available: http\\\\www.internet.ephone.net"
          },
          {
            "key": "10.1002\/(SICI)1520-6386(199933)10:3<51::AID-CIR8>3.0.CO;2-A-BIB16",
            "unstructured": "Writing Instrument Firms. Available: http:\\\\www.iswt.com\/pen\/firms.htm"
          }
        ],
        "container-title": [
          "Competitive Intelligence Review"
        ],
        "link": [
          {
            "URL": "https:\/\/api.wiley.com\/onlinelibrary\/tdm\/v1\/articles\/10.1002%2F(SICI)1520-6386(199933)10:3%3C51::AID-CIR8%3E3.0.CO;2-A",
            "content-type": "unspecified",
            "content-version": "vor",
            "intended-application": "text-mining"
          }
        ],
        "deposited": {
          "date-parts": [
            [
              2017,
              4,
              5
            ]
          ],
          "date-time": "2017-04-05T01:20:00Z",
          "timestamp": 1491355200000
        },
        "score": 1.0,
        "issued": {
          "date-parts": [
            [
              1999
            ]
          ]
        },
        "references-count": 16,
        "journal-issue": {
          "issue": "3"
        },
        "URL": "http:\/\/dx.doi.org\/10.1002\/(sici)1520-6386(199933)10:3<51::aid-cir8>3.0.co;2-a",
        "relation": {
          "cites": []
        },
        "ISSN": [
          "1058-0247",
          "1520-6386"
        ],
        "issn-type": [
          {
            "value": "1058-0247",
            "type": "print"
          },
          {
            "value": "1520-6386",
            "type": "electronic"
          }
        ]
      },
      {
        "indexed": {
          "date-parts": [
            [
              2017,
              10,
              23
            ]
          ],
          "date-time": "2017-10-23T14:10:55Z",
          "timestamp": 1508767855408
        },
        "reference-count": 0,
        "publisher": "Wiley-Blackwell",
        "issue": "5",
        "license": [
          {
            "URL": "http:\/\/doi.wiley.com\/10.1002\/tdm_license_1.1",
            "start": {
              "date-parts": [
                [
                  2015,
                  9,
                  1
                ]
              ],
              "date-time": "2015-09-01T00:00:00Z",
              "timestamp": 1441065600000
            },
            "delay-in-days": 5800,
            "content-version": "tdm"
          }
        ],
        "content-domain": {
          "domain": [],
          "crossmark-restriction": false
        },
        "short-container-title": [
          "Cytometry"
        ],
        "published-print": {
          "date-parts": [
            [
              1999,
              10,
              15
            ]
          ]
        },
        "DOI": "10.1002\/(sici)1097-0320(19991015)38:5<256::aid-cyto9>3.0.co;2-b",
        "type": "journal-article",
        "created": {
          "date-parts": [
            [
              2002,
              8,
              25
            ]
          ],
          "date-time": "2002-08-25T20:03:22Z",
          "timestamp": 1030305802000
        },
        "page": "256-257",
        "source": "Crossref",
        "is-referenced-by-count": 0,
        "title": [
          "Forum: Journal Club"
        ],
        "prefix": "10.1002",
        "volume": "38",
        "member": "311",
        "container-title": [
          "Cytometry"
        ],
        "link": [
          {
            "URL": "https:\/\/api.wiley.com\/onlinelibrary\/tdm\/v1\/articles\/10.1002%2F(SICI)1097-0320(19991015)38:5%3C256::AID-CYTO9%3E3.0.CO;2-B",
            "content-type": "unspecified",
            "content-version": "vor",
            "intended-application": "text-mining"
          }
        ],
        "deposited": {
          "date-parts": [
            [
              2017,
              4,
              5
            ]
          ],
          "date-time": "2017-04-05T02:32:56Z",
          "timestamp": 1491359576000
        },
        "score": 1.0,
        "issued": {
          "date-parts": [
            [
              1999,
              10,
              15
            ]
          ]
        },
        "references-count": 0,
        "journal-issue": {
          "issue": "5"
        },
        "URL": "http:\/\/dx.doi.org\/10.1002\/(sici)1097-0320(19991015)38:5<256::aid-cyto9>3.0.co;2-b",
        "ISSN": [
          "0196-4763",
          "1097-0320"
        ],
        "issn-type": [
          {
            "value": "0196-4763",
            "type": "print"
          },
          {
            "value": "1097-0320",
            "type": "electronic"
          }
        ],
        "subject": [
          "Biophysics",
          "Pathology and Forensic Medicine",
          "Cell Biology",
          "Endocrinology",
          "Hematology"
        ]
      }
    ],
    "items-per-page": 10,
    "query": {
      "start-index": 0,
      "search-terms": null
    }
  }
}

and my case classes

package io.crossref

case class DateParts(`date-parts`: Array[Array[Int]], `date-time`: String, timestamp: Long)

case class PartialDate(`date-parts`: Array[Array[Int]])

case class ContentDomain(domain: Seq[String], `crossmark-restriction`: Boolean)

case class Affiliation(name: String)

case class Authors(given: Option[String], family: Option[String], affiliation: Seq[Affiliation])

case class PublishedOnline(dateParts: DateParts)

case class Deposited(dateParts: DateParts)

case class Issued(dateParts: DateParts)

case class Link(URL: String, `content-type`: String, `content-version`: String, `intended-application`: String)

case class ISSNType(value: String, `type`: String)

case class Relation(`id-type`: String, id: String, `asserted-by`: String)

case class ClinicalTrialNumber(`clinical-trial-number`: String, registry: String, `type`: Option[String])

case class Contributor(family: String,
                       given: Option[String],
                       ORCID: Option[String],
                       `authenticated-orcid`: Option[Boolean],
                       affiliation: Seq[Affiliation])

case class Update(updated: PartialDate, DOI: String, `type`: String, label: Option[String])

case class Assertion(name: String,
                     value: String,
                     URL: Option[String],
                     explanation: Option[String],
                     label: Option[String],
                     order: Option[Int],
                     group: Option[AssertionGroup])

case class AssertionGroup(name: String, label: Option[String])

case class License(`content-version`: String, `delay-in-days`: Int, start: DateParts, URL: String)

case class ResourceLink(`intended-application`: String, `content-version`: String, URL: String, `content-type`: Option[String])

case class Funder(name: String, DOI: Option[String], award: Seq[String], `doi-asserted-by`: Option[String])

case class JournalIssue(issue: String)

case class Reference(key: String,
                     author: Option[String],
                     issue: Option[String],
                     edition: Option[String],
                     component: Option[String],
                     `standard-designator`: Option[String],
                     `standards-body`: Option[String],
                     unstructured: Option[String],
                     `article-title`: Option[String],
                     `series-title`: Option[String],
                     `volume-title`: Option[String],
                     `journal-issue`: Option[JournalIssue],
                     ISSN: Option[String],
                     `issn-type`: Option[String],
                     ISBN: Option[String],
                     `isbn-type`: Option[String],
                     volume: Option[String],
                     `first-page`: Option[String],
                     year: Option[String],
                     `journal-title`: Option[String],
                     DOI: Option[String],
                     `doi-asserted-by`: Option[String])

case class Publication(publisher: String,
                       title: Seq[String],
                       `original-title`: Seq[String],
                       `short-title`: Seq[String],
                       `abstract`: Option[String],
                       `reference-count`: Int,
                       `references-count`: Int,
                       `is-referenced-by-count`: Int,
                       source: String,
                       prefix: String,
                       DOI: String,
                       URL: String,
                       member: String,
                       `type`: String,
                       created: DateParts,
                       deposited: DateParts,
                       indexed: DateParts,
                       issued: PartialDate,
                       posted: Option[PartialDate],
                       accepted: Option[PartialDate],
                       subtitle: Seq[String],
                       `container-title`: Seq[String],
                       `short-container-title`: Seq[String],
                       `group-title`: Option[String],
                       issue: Option[String],
                       volume: Option[String],
                       page: Option[String],
                       `article-number`: Option[String],
                       `published-print`: Option[PartialDate],
                       `published-online`: Option[PartialDate],
                       subject: Seq[String],
                       ISSN: Seq[String],
                       `issn-type`: Seq[ISSNType],
                       ISBN: Seq[String],
                       archive: Seq[String],
                       license: Seq[License],
                       funder: Seq[Funder],
                       assertion: Seq[Assertion],
                       author: Seq[Authors],
                       editor: Seq[Contributor],
                       chair: Seq[Contributor],
                       translator: Seq[Contributor],
                       `update-to`: Seq[Update],
                       `update-policy`: Option[String],
                       link: Seq[Link],
                       `clinical-trial-number`: Seq[ClinicalTrialNumber],
                       `alternative-id`: Option[String],
                       reference: Seq[Reference] = Seq.empty[Reference],
                       `content-domain`: Option[ContentDomain],
                       relation: Option[Map[String, Relation]],
                       score: Double)

case class Query(`start-index`: Int, `search-terms`: Option[String])

case class Items(facets: Map[String, String],
                 `total-results`: Long,
                 items: Seq[Publication],
                 `items-per-page`: Int,
                 query: Query,
                 `next-cursor`: Option[String])

case class Response[M <: Product](status: String, messageType: String, messageVersion: String, message: M)

case class ItemResponse(status: String, `message-type`: String, `message-version`: String, message: Items)

Finally here is the generated parser

package io.crossref

import com.github.plokhotnyuk.jsoniter_scala.core._;
import scala.annotation.switch;

final class JsonCodecThing extends JsonValueCodec[io.crossref.ItemResponse] {
  def nullValue: io.crossref.ItemResponse                                                      = null;
  def decodeValue(in: JsonReader, default: io.crossref.ItemResponse): io.crossref.ItemResponse = d0(in, default);
  def encodeValue(x: io.crossref.ItemResponse, out: JsonWriter): Unit                          = e0(x, out);
  private[this] val v0: Array[Array[Int]]                                                      = new Array[Array[Int]](0);
  private[this] val v1: Array[Int]                                                             = new Array[Int](0);
  private[this] val r0: Array[String]                                                          = Array("status", "message-type", "message-version", "message");
  private[this] val r1: Array[String]                                                          = Array("total-results", "items-per-page", "query");
  private[this] val r2: Array[String] = Array(
    "publisher",
    "reference-count",
    "references-count",
    "is-referenced-by-count",
    "source",
    "prefix",
    "DOI",
    "URL",
    "member",
    "type",
    "created",
    "deposited",
    "indexed",
    "issued",
    "score"
  );
  private[this] val r3: Array[String]  = Array("date-time", "timestamp");
  private[this] val r4: Array[String]  = Array("value", "type");
  private[this] val r5: Array[String]  = Array("content-version", "delay-in-days", "start", "URL");
  private[this] val r6: Array[String]  = Array("name");
  private[this] val r7: Array[String]  = Array("name", "value");
  private[this] val r8: Array[String]  = Array("name");
  private[this] val r9: Array[String]  = Array("name");
  private[this] val r10: Array[String] = Array("family");
  private[this] val r11: Array[String] = Array("updated", "DOI", "type");
  private[this] val r12: Array[String] = Array("URL", "content-type", "content-version", "intended-application");
  private[this] val r13: Array[String] = Array("clinical-trial-number", "registry");
  private[this] val r14: Array[String] = Array("key");
  private[this] val r15: Array[String] = Array("issue");
  private[this] val r16: Array[String] = Array("crossmark-restriction");
  private[this] val r17: Array[String] = Array("id-type", "id", "asserted-by");
  private[this] val r18: Array[String] = Array("start-index");
  private[this] def d2(in: JsonReader,
                       default: scala.collection.immutable.Map[String, String]): scala.collection.immutable.Map[String, String] =
    if (in.isNextToken('{'))
      if (in.isNextToken('}'))
        default
      else {
        in.rollbackToken();
        var x = Map.empty[String, String];
        do x = x.updated(in.readKeyAsString(), in.readString(null)) while (in.isNextToken(','));
        if (in.isCurrentToken('}'))
          x
        else
          in.objectEndOrCommaError()
      } else
      in.readNullOrTokenError(default, '{');
  private[this] def d5(in: JsonReader, default: Seq[String]): Seq[String] =
    if (in.isNextToken('['))
      if (in.isNextToken(']'))
        default
      else {
        in.rollbackToken();
        val x = Seq.newBuilder[String];
        do x.+=(in.readString(null)) while (in.isNextToken(','));
        if (in.isCurrentToken(']'))
          x.result()
        else
          in.arrayEndOrCommaError()
      } else
      in.readNullOrTokenError(default, '[');
  private[this] def d6(in: JsonReader, default: Option[String]): Option[String] =
    if (in.isNextToken('n'))
      in.readNullOrError(default, "expected value or null")
    else {
      in.rollbackToken();
      Some(in.readString(null))
    };
  private[this] def d9(in: JsonReader, default: Array[Int]): Array[Int] =
    if (in.isNextToken('['))
      if (in.isNextToken(']'))
        default
      else {
        in.rollbackToken();
        var x = new Array[Int](16);
        var i = 0;
        do {
          if (i.==(x.length))
            x = java.util.Arrays.copyOf(x, i.<<(1))
          else
            ();
          x.update(i, in.readInt());
          i.+=(1)
        } while (in.isNextToken(','));
        if (in.isCurrentToken(']'))
          if (i.==(x.length))
            x
          else
            java.util.Arrays.copyOf(x, i)
        else
          in.arrayEndOrCommaError()
      } else
      in.readNullOrTokenError(default, '[');
  private[this] def d8(in: JsonReader, default: Array[Array[Int]]): Array[Array[Int]] =
    if (in.isNextToken('['))
      if (in.isNextToken(']'))
        default
      else {
        in.rollbackToken();
        var x = new Array[Array[Int]](16);
        var i = 0;
        do {
          if (i.==(x.length))
            x = java.util.Arrays.copyOf(x, i.<<(1))
          else
            ();
          x.update(i, d9(in, v1));
          i.+=(1)
        } while (in.isNextToken(','));
        if (in.isCurrentToken(']'))
          if (i.==(x.length))
            x
          else
            java.util.Arrays.copyOf(x, i)
        else
          in.arrayEndOrCommaError()
      } else
      in.readNullOrTokenError(default, '[');
  private[this] def d7(in: JsonReader, default: io.crossref.DateParts): io.crossref.DateParts =
    if (in.isNextToken('{')) {
      var `_date-parts`: Array[Array[Int]] = v0;
      var `_date-time`: String             = null;
      var _timestamp: Long                 = 0L;
      var p0                               = 7;
      if (in.isNextToken('}').`unary_!`) {
        in.rollbackToken();
        do {
          val l = in.readKeyAsCharBuf();
          (in.charBufToHashCode(l): @switch) match {
            case -560061439 =>
              if (in.isCharBufEqualsTo(l, "date-parts")) {
                if (p0.&(1).!=(0))
                  p0.^=(1)
                else
                  in.duplicatedKeyError(l);
                `_date-parts` = d8(in, `_date-parts`)
              } else
                in.unexpectedKeyError(l)
            case -295034484 =>
              if (in.isCharBufEqualsTo(l, "date-time")) {
                if (p0.&(2).!=(0))
                  p0.^=(2)
                else
                  in.duplicatedKeyError(l);
                `_date-time` = in.readString(`_date-time`)
              } else
                in.unexpectedKeyError(l)
            case 55126294 =>
              if (in.isCharBufEqualsTo(l, "timestamp")) {
                if (p0.&(4).!=(0))
                  p0.^=(4)
                else
                  in.duplicatedKeyError(l);
                _timestamp = in.readLong()
              } else
                in.unexpectedKeyError(l)
            case _ => in.unexpectedKeyError(l)
          }
        } while (in.isNextToken(','));
        if (in.isCurrentToken('}').`unary_!`)
          in.objectEndOrCommaError()
        else
          ()
      } else
        ();
      if (p0.&(6).!=(0))
        in.requiredFieldError(r3(Integer.numberOfTrailingZeros(p0)))
      else
        ();
      new io.crossref.DateParts(`date-parts` = `_date-parts`, `date-time` = `_date-time`, timestamp = _timestamp)
    } else
      in.readNullOrTokenError(default, '{');
  private[this] def d10(in: JsonReader, default: io.crossref.PartialDate): io.crossref.PartialDate =
    if (in.isNextToken('{')) {
      var `_date-parts`: Array[Array[Int]] = v0;
      var p0                               = 1;
      if (in.isNextToken('}').`unary_!`) {
        in.rollbackToken();
        do {
          val l = in.readKeyAsCharBuf();
          (in.charBufToHashCode(l): @switch) match {
            case -560061439 =>
              if (in.isCharBufEqualsTo(l, "date-parts")) {
                if (p0.&(1).!=(0))
                  p0.^=(1)
                else
                  in.duplicatedKeyError(l);
                `_date-parts` = d8(in, `_date-parts`)
              } else
                in.unexpectedKeyError(l)
            case _ => in.unexpectedKeyError(l)
          }
        } while (in.isNextToken(','));
        if (in.isCurrentToken('}').`unary_!`)
          in.objectEndOrCommaError()
        else
          ()
      } else
        ();
      new io.crossref.PartialDate(`date-parts` = `_date-parts`)
    } else
      in.readNullOrTokenError(default, '{');
  private[this] def d11(in: JsonReader, default: Option[io.crossref.PartialDate]): Option[io.crossref.PartialDate] =
    if (in.isNextToken('n'))
      in.readNullOrError(default, "expected value or null")
    else {
      in.rollbackToken();
      Some(d10(in, null))
    };
  private[this] def d13(in: JsonReader, default: io.crossref.ISSNType): io.crossref.ISSNType =
    if (in.isNextToken('{')) {
      var _value: String = null;
      var _type: String  = null;
      var p0             = 3;
      if (in.isNextToken('}').`unary_!`) {
        in.rollbackToken();
        do {
          val l = in.readKeyAsCharBuf();
          (in.charBufToHashCode(l): @switch) match {
            case 111972721 =>
              if (in.isCharBufEqualsTo(l, "value")) {
                if (p0.&(1).!=(0))
                  p0.^=(1)
                else
                  in.duplicatedKeyError(l);
                _value = in.readString(_value)
              } else
                in.unexpectedKeyError(l)
            case 3575610 =>
              if (in.isCharBufEqualsTo(l, "type")) {
                if (p0.&(2).!=(0))
                  p0.^=(2)
                else
                  in.duplicatedKeyError(l);
                _type = in.readString(_type)
              } else
                in.unexpectedKeyError(l)
            case _ => in.unexpectedKeyError(l)
          }
        } while (in.isNextToken(','));
        if (in.isCurrentToken('}').`unary_!`)
          in.objectEndOrCommaError()
        else
          ()
      } else
        ();
      if (p0.&(3).!=(0))
        in.requiredFieldError(r4(Integer.numberOfTrailingZeros(p0)))
      else
        ();
      new io.crossref.ISSNType(value = _value, `type` = _type)
    } else
      in.readNullOrTokenError(default, '{');
  private[this] def d12(in: JsonReader, default: Seq[io.crossref.ISSNType]): Seq[io.crossref.ISSNType] =
    if (in.isNextToken('['))
      if (in.isNextToken(']'))
        default
      else {
        in.rollbackToken();
        val x = Seq.newBuilder[io.crossref.ISSNType];
        do x.+=(d13(in, null)) while (in.isNextToken(','));
        if (in.isCurrentToken(']'))
          x.result()
        else
          in.arrayEndOrCommaError()
      } else
      in.readNullOrTokenError(default, '[');
  private[this] def d15(in: JsonReader, default: io.crossref.License): io.crossref.License =
    if (in.isNextToken('{')) {
      var `_content-version`: String    = null;
      var `_delay-in-days`: Int         = 0;
      var _start: io.crossref.DateParts = null;
      var _URL: String                  = null;
      var p0                            = 15;
      if (in.isNextToken('}').`unary_!`) {
        in.rollbackToken();
        do {
          val l = in.readKeyAsCharBuf();
          (in.charBufToHashCode(l): @switch) match {
            case -467293308 =>
              if (in.isCharBufEqualsTo(l, "content-version")) {
                if (p0.&(1).!=(0))
                  p0.^=(1)
                else
                  in.duplicatedKeyError(l);
                `_content-version` = in.readString(`_content-version`)
              } else
                in.unexpectedKeyError(l)
            case 1548606901 =>
              if (in.isCharBufEqualsTo(l, "delay-in-days")) {
                if (p0.&(2).!=(0))
                  p0.^=(2)
                else
                  in.duplicatedKeyError(l);
                `_delay-in-days` = in.readInt()
              } else
                in.unexpectedKeyError(l)
            case 109757538 =>
              if (in.isCharBufEqualsTo(l, "start")) {
                if (p0.&(4).!=(0))
                  p0.^=(4)
                else
                  in.duplicatedKeyError(l);
                _start = d7(in, _start)
              } else
                in.unexpectedKeyError(l)
            case 84303 =>
              if (in.isCharBufEqualsTo(l, "URL")) {
                if (p0.&(8).!=(0))
                  p0.^=(8)
                else
                  in.duplicatedKeyError(l);
                _URL = in.readString(_URL)
              } else
                in.unexpectedKeyError(l)
            case _ => in.unexpectedKeyError(l)
          }
        } while (in.isNextToken(','));
        if (in.isCurrentToken('}').`unary_!`)
          in.objectEndOrCommaError()
        else
          ()
      } else
        ();
      if (p0.&(15).!=(0))
        in.requiredFieldError(r5(Integer.numberOfTrailingZeros(p0)))
      else
        ();
      new io.crossref.License(`content-version` = `_content-version`, `delay-in-days` = `_delay-in-days`, start = _start, URL = _URL)
    } else
      in.readNullOrTokenError(default, '{');
  private[this] def d14(in: JsonReader, default: Seq[io.crossref.License]): Seq[io.crossref.License] =
    if (in.isNextToken('['))
      if (in.isNextToken(']'))
        default
      else {
        in.rollbackToken();
        val x = Seq.newBuilder[io.crossref.License];
        do x.+=(d15(in, null)) while (in.isNextToken(','));
        if (in.isCurrentToken(']'))
          x.result()
        else
          in.arrayEndOrCommaError()
      } else
      in.readNullOrTokenError(default, '[');
  private[this] def d17(in: JsonReader, default: io.crossref.Funder): io.crossref.Funder =
    if (in.isNextToken('{')) {
      var _name: String                      = null;
      var _DOI: Option[String]               = None;
      var _award: Seq[String]                = Seq.empty[String];
      var `_doi-asserted-by`: Option[String] = None;
      var p0                                 = 15;
      if (in.isNextToken('}').`unary_!`) {
        in.rollbackToken();
        do {
          val l = in.readKeyAsCharBuf();
          (in.charBufToHashCode(l): @switch) match {
            case 3373707 =>
              if (in.isCharBufEqualsTo(l, "name")) {
                if (p0.&(1).!=(0))
                  p0.^=(1)
                else
                  in.duplicatedKeyError(l);
                _name = in.readString(_name)
              } else
                in.unexpectedKeyError(l)
            case 67870 =>
              if (in.isCharBufEqualsTo(l, "DOI")) {
                if (p0.&(2).!=(0))
                  p0.^=(2)
                else
                  in.duplicatedKeyError(l);
                _DOI = d6(in, _DOI)
              } else
                in.unexpectedKeyError(l)
            case 93223517 =>
              if (in.isCharBufEqualsTo(l, "award")) {
                if (p0.&(4).!=(0))
                  p0.^=(4)
                else
                  in.duplicatedKeyError(l);
                _award = d5(in, _award)
              } else
                in.unexpectedKeyError(l)
            case 1330102960 =>
              if (in.isCharBufEqualsTo(l, "doi-asserted-by")) {
                if (p0.&(8).!=(0))
                  p0.^=(8)
                else
                  in.duplicatedKeyError(l);
                `_doi-asserted-by` = d6(in, `_doi-asserted-by`)
              } else
                in.unexpectedKeyError(l)
            case _ => in.unexpectedKeyError(l)
          }
        } while (in.isNextToken(','));
        if (in.isCurrentToken('}').`unary_!`)
          in.objectEndOrCommaError()
        else
          ()
      } else
        ();
      if (p0.&(1).!=(0))
        in.requiredFieldError(r6(Integer.numberOfTrailingZeros(p0)))
      else
        ();
      new io.crossref.Funder(name = _name, DOI = _DOI, award = _award, `doi-asserted-by` = `_doi-asserted-by`)
    } else
      in.readNullOrTokenError(default, '{');
  private[this] def d16(in: JsonReader, default: Seq[io.crossref.Funder]): Seq[io.crossref.Funder] =
    if (in.isNextToken('['))
      if (in.isNextToken(']'))
        default
      else {
        in.rollbackToken();
        val x = Seq.newBuilder[io.crossref.Funder];
        do x.+=(d17(in, null)) while (in.isNextToken(','));
        if (in.isCurrentToken(']'))
          x.result()
        else
          in.arrayEndOrCommaError()
      } else
      in.readNullOrTokenError(default, '[');
  private[this] def d20(in: JsonReader, default: Option[Int]): Option[Int] =
    if (in.isNextToken('n'))
      in.readNullOrError(default, "expected value or null")
    else {
      in.rollbackToken();
      Some(in.readInt())
    };
  private[this] def d22(in: JsonReader, default: io.crossref.AssertionGroup): io.crossref.AssertionGroup =
    if (in.isNextToken('{')) {
      var _name: String          = null;
      var _label: Option[String] = None;
      var p0                     = 3;
      if (in.isNextToken('}').`unary_!`) {
        in.rollbackToken();
        do {
          val l = in.readKeyAsCharBuf();
          (in.charBufToHashCode(l): @switch) match {
            case 3373707 =>
              if (in.isCharBufEqualsTo(l, "name")) {
                if (p0.&(1).!=(0))
                  p0.^=(1)
                else
                  in.duplicatedKeyError(l);
                _name = in.readString(_name)
              } else
                in.unexpectedKeyError(l)
            case 102727412 =>
              if (in.isCharBufEqualsTo(l, "label")) {
                if (p0.&(2).!=(0))
                  p0.^=(2)
                else
                  in.duplicatedKeyError(l);
                _label = d6(in, _label)
              } else
                in.unexpectedKeyError(l)
            case _ => in.unexpectedKeyError(l)
          }
        } while (in.isNextToken(','));
        if (in.isCurrentToken('}').`unary_!`)
          in.objectEndOrCommaError()
        else
          ()
      } else
        ();
      if (p0.&(1).!=(0))
        in.requiredFieldError(r8(Integer.numberOfTrailingZeros(p0)))
      else
        ();
      new io.crossref.AssertionGroup(name = _name, label = _label)
    } else
      in.readNullOrTokenError(default, '{');
  private[this] def d21(in: JsonReader, default: Option[io.crossref.AssertionGroup]): Option[io.crossref.AssertionGroup] =
    if (in.isNextToken('n'))
      in.readNullOrError(default, "expected value or null")
    else {
      in.rollbackToken();
      Some(d22(in, null))
    };
  private[this] def d19(in: JsonReader, default: io.crossref.Assertion): io.crossref.Assertion =
    if (in.isNextToken('{')) {
      var _name: String                              = null;
      var _value: String                             = null;
      var _URL: Option[String]                       = None;
      var _explanation: Option[String]               = None;
      var _label: Option[String]                     = None;
      var _order: Option[Int]                        = None;
      var _group: Option[io.crossref.AssertionGroup] = None;
      var p0                                         = 127;
      if (in.isNextToken('}').`unary_!`) {
        in.rollbackToken();
        do {
          val l = in.readKeyAsCharBuf();
          (in.charBufToHashCode(l): @switch) match {
            case 3373707 =>
              if (in.isCharBufEqualsTo(l, "name")) {
                if (p0.&(1).!=(0))
                  p0.^=(1)
                else
                  in.duplicatedKeyError(l);
                _name = in.readString(_name)
              } else
                in.unexpectedKeyError(l)
            case 111972721 =>
              if (in.isCharBufEqualsTo(l, "value")) {
                if (p0.&(2).!=(0))
                  p0.^=(2)
                else
                  in.duplicatedKeyError(l);
                _value = in.readString(_value)
              } else
                in.unexpectedKeyError(l)
            case 84303 =>
              if (in.isCharBufEqualsTo(l, "URL")) {
                if (p0.&(4).!=(0))
                  p0.^=(4)
                else
                  in.duplicatedKeyError(l);
                _URL = d6(in, _URL)
              } else
                in.unexpectedKeyError(l)
            case -1105867239 =>
              if (in.isCharBufEqualsTo(l, "explanation")) {
                if (p0.&(8).!=(0))
                  p0.^=(8)
                else
                  in.duplicatedKeyError(l);
                _explanation = d6(in, _explanation)
              } else
                in.unexpectedKeyError(l)
            case 102727412 =>
              if (in.isCharBufEqualsTo(l, "label")) {
                if (p0.&(16).!=(0))
                  p0.^=(16)
                else
                  in.duplicatedKeyError(l);
                _label = d6(in, _label)
              } else
                in.unexpectedKeyError(l)
            case 106006350 =>
              if (in.isCharBufEqualsTo(l, "order")) {
                if (p0.&(32).!=(0))
                  p0.^=(32)
                else
                  in.duplicatedKeyError(l);
                _order = d20(in, _order)
              } else
                in.unexpectedKeyError(l)
            case 98629247 =>
              if (in.isCharBufEqualsTo(l, "group")) {
                if (p0.&(64).!=(0))
                  p0.^=(64)
                else
                  in.duplicatedKeyError(l);
                _group = d21(in, _group)
              } else
                in.unexpectedKeyError(l)
            case _ => in.unexpectedKeyError(l)
          }
        } while (in.isNextToken(','));
        if (in.isCurrentToken('}').`unary_!`)
          in.objectEndOrCommaError()
        else
          ()
      } else
        ();
      if (p0.&(3).!=(0))
        in.requiredFieldError(r7(Integer.numberOfTrailingZeros(p0)))
      else
        ();
      new io.crossref.Assertion(name = _name,
                                value = _value,
                                URL = _URL,
                                explanation = _explanation,
                                label = _label,
                                order = _order,
                                group = _group)
    } else
      in.readNullOrTokenError(default, '{');
  private[this] def d18(in: JsonReader, default: Seq[io.crossref.Assertion]): Seq[io.crossref.Assertion] =
    if (in.isNextToken('['))
      if (in.isNextToken(']'))
        default
      else {
        in.rollbackToken();
        val x = Seq.newBuilder[io.crossref.Assertion];
        do x.+=(d19(in, null)) while (in.isNextToken(','));
        if (in.isCurrentToken(']'))
          x.result()
        else
          in.arrayEndOrCommaError()
      } else
      in.readNullOrTokenError(default, '[');
  private[this] def d26(in: JsonReader, default: io.crossref.Affiliation): io.crossref.Affiliation =
    if (in.isNextToken('{')) {
      var _name: String = null;
      var p0            = 1;
      if (in.isNextToken('}').`unary_!`) {
        in.rollbackToken();
        do {
          val l = in.readKeyAsCharBuf();
          (in.charBufToHashCode(l): @switch) match {
            case 3373707 =>
              if (in.isCharBufEqualsTo(l, "name")) {
                if (p0.&(1).!=(0))
                  p0.^=(1)
                else
                  in.duplicatedKeyError(l);
                _name = in.readString(_name)
              } else
                in.unexpectedKeyError(l)
            case _ => in.unexpectedKeyError(l)
          }
        } while (in.isNextToken(','));
        if (in.isCurrentToken('}').`unary_!`)
          in.objectEndOrCommaError()
        else
          ()
      } else
        ();
      if (p0.&(1).!=(0))
        in.requiredFieldError(r9(Integer.numberOfTrailingZeros(p0)))
      else
        ();
      new io.crossref.Affiliation(name = _name)
    } else
      in.readNullOrTokenError(default, '{');
  private[this] def d25(in: JsonReader, default: Seq[io.crossref.Affiliation]): Seq[io.crossref.Affiliation] =
    if (in.isNextToken('['))
      if (in.isNextToken(']'))
        default
      else {
        in.rollbackToken();
        val x = Seq.newBuilder[io.crossref.Affiliation];
        do x.+=(d26(in, null)) while (in.isNextToken(','));
        if (in.isCurrentToken(']'))
          x.result()
        else
          in.arrayEndOrCommaError()
      } else
      in.readNullOrTokenError(default, '[');
  private[this] def d24(in: JsonReader, default: io.crossref.Authors): io.crossref.Authors =
    if (in.isNextToken('{')) {
      var _given: Option[String]                     = None;
      var _family: Option[String]                    = None;
      var _affiliation: Seq[io.crossref.Affiliation] = Seq.empty[io.crossref.Affiliation];
      var p0                                         = 7;
      if (in.isNextToken('}').`unary_!`) {
        in.rollbackToken();
        do {
          val l = in.readKeyAsCharBuf();
          (in.charBufToHashCode(l): @switch) match {
            case 98367357 =>
              if (in.isCharBufEqualsTo(l, "given")) {
                if (p0.&(1).!=(0))
                  p0.^=(1)
                else
                  in.duplicatedKeyError(l);
                _given = d6(in, _given)
              } else
                in.unexpectedKeyError(l)
            case -1281860764 =>
              if (in.isCharBufEqualsTo(l, "family")) {
                if (p0.&(2).!=(0))
                  p0.^=(2)
                else
                  in.duplicatedKeyError(l);
                _family = d6(in, _family)
              } else
                in.unexpectedKeyError(l)
            case 2019918576 =>
              if (in.isCharBufEqualsTo(l, "affiliation")) {
                if (p0.&(4).!=(0))
                  p0.^=(4)
                else
                  in.duplicatedKeyError(l);
                _affiliation = d25(in, _affiliation)
              } else
                in.unexpectedKeyError(l)
            case _ => in.unexpectedKeyError(l)
          }
        } while (in.isNextToken(','));
        if (in.isCurrentToken('}').`unary_!`)
          in.objectEndOrCommaError()
        else
          ()
      } else
        ();
      new io.crossref.Authors(given = _given, family = _family, affiliation = _affiliation)
    } else
      in.readNullOrTokenError(default, '{');
  private[this] def d23(in: JsonReader, default: Seq[io.crossref.Authors]): Seq[io.crossref.Authors] =
    if (in.isNextToken('['))
      if (in.isNextToken(']'))
        default
      else {
        in.rollbackToken();
        val x = Seq.newBuilder[io.crossref.Authors];
        do x.+=(d24(in, null)) while (in.isNextToken(','));
        if (in.isCurrentToken(']'))
          x.result()
        else
          in.arrayEndOrCommaError()
      } else
      in.readNullOrTokenError(default, '[');
  private[this] def d29(in: JsonReader, default: Option[Boolean]): Option[Boolean] =
    if (in.isNextToken('n'))
      in.readNullOrError(default, "expected value or null")
    else {
      in.rollbackToken();
      Some(in.readBoolean())
    };
  private[this] def d28(in: JsonReader, default: io.crossref.Contributor): io.crossref.Contributor =
    if (in.isNextToken('{')) {
      var _family: String                            = null;
      var _given: Option[String]                     = None;
      var _ORCID: Option[String]                     = None;
      var `_authenticated-orcid`: Option[Boolean]    = None;
      var _affiliation: Seq[io.crossref.Affiliation] = Seq.empty[io.crossref.Affiliation];
      var p0                                         = 31;
      if (in.isNextToken('}').`unary_!`) {
        in.rollbackToken();
        do {
          val l = in.readKeyAsCharBuf();
          (in.charBufToHashCode(l): @switch) match {
            case -1281860764 =>
              if (in.isCharBufEqualsTo(l, "family")) {
                if (p0.&(1).!=(0))
                  p0.^=(1)
                else
                  in.duplicatedKeyError(l);
                _family = in.readString(_family)
              } else
                in.unexpectedKeyError(l)
            case 98367357 =>
              if (in.isCharBufEqualsTo(l, "given")) {
                if (p0.&(2).!=(0))
                  p0.^=(2)
                else
                  in.duplicatedKeyError(l);
                _given = d6(in, _given)
              } else
                in.unexpectedKeyError(l)
            case 75467739 =>
              if (in.isCharBufEqualsTo(l, "ORCID")) {
                if (p0.&(4).!=(0))
                  p0.^=(4)
                else
                  in.duplicatedKeyError(l);
                _ORCID = d6(in, _ORCID)
              } else
                in.unexpectedKeyError(l)
            case -55038755 =>
              if (in.isCharBufEqualsTo(l, "authenticated-orcid")) {
                if (p0.&(8).!=(0))
                  p0.^=(8)
                else
                  in.duplicatedKeyError(l);
                `_authenticated-orcid` = d29(in, `_authenticated-orcid`)
              } else
                in.unexpectedKeyError(l)
            case 2019918576 =>
              if (in.isCharBufEqualsTo(l, "affiliation")) {
                if (p0.&(16).!=(0))
                  p0.^=(16)
                else
                  in.duplicatedKeyError(l);
                _affiliation = d25(in, _affiliation)
              } else
                in.unexpectedKeyError(l)
            case _ => in.unexpectedKeyError(l)
          }
        } while (in.isNextToken(','));
        if (in.isCurrentToken('}').`unary_!`)
          in.objectEndOrCommaError()
        else
          ()
      } else
        ();
      if (p0.&(1).!=(0))
        in.requiredFieldError(r10(Integer.numberOfTrailingZeros(p0)))
      else
        ();
      new io.crossref.Contributor(family = _family,
                                  given = _given,
                                  ORCID = _ORCID,
                                  `authenticated-orcid` = `_authenticated-orcid`,
                                  affiliation = _affiliation)
    } else
      in.readNullOrTokenError(default, '{');
  private[this] def d27(in: JsonReader, default: Seq[io.crossref.Contributor]): Seq[io.crossref.Contributor] =
    if (in.isNextToken('['))
      if (in.isNextToken(']'))
        default
      else {
        in.rollbackToken();
        val x = Seq.newBuilder[io.crossref.Contributor];
        do x.+=(d28(in, null)) while (in.isNextToken(','));
        if (in.isCurrentToken(']'))
          x.result()
        else
          in.arrayEndOrCommaError()
      } else
      in.readNullOrTokenError(default, '[');
  private[this] def d31(in: JsonReader, default: io.crossref.Update): io.crossref.Update =
    if (in.isNextToken('{')) {
      var _updated: io.crossref.PartialDate = null;
      var _DOI: String                      = null;
      var _type: String                     = null;
      var _label: Option[String]            = None;
      var p0                                = 15;
      if (in.isNextToken('}').`unary_!`) {
        in.rollbackToken();
        do {
          val l = in.readKeyAsCharBuf();
          (in.charBufToHashCode(l): @switch) match {
            case -234430277 =>
              if (in.isCharBufEqualsTo(l, "updated")) {
                if (p0.&(1).!=(0))
                  p0.^=(1)
                else
                  in.duplicatedKeyError(l);
                _updated = d10(in, _updated)
              } else
                in.unexpectedKeyError(l)
            case 67870 =>
              if (in.isCharBufEqualsTo(l, "DOI")) {
                if (p0.&(2).!=(0))
                  p0.^=(2)
                else
                  in.duplicatedKeyError(l);
                _DOI = in.readString(_DOI)
              } else
                in.unexpectedKeyError(l)
            case 3575610 =>
              if (in.isCharBufEqualsTo(l, "type")) {
                if (p0.&(4).!=(0))
                  p0.^=(4)
                else
                  in.duplicatedKeyError(l);
                _type = in.readString(_type)
              } else
                in.unexpectedKeyError(l)
            case 102727412 =>
              if (in.isCharBufEqualsTo(l, "label")) {
                if (p0.&(8).!=(0))
                  p0.^=(8)
                else
                  in.duplicatedKeyError(l);
                _label = d6(in, _label)
              } else
                in.unexpectedKeyError(l)
            case _ => in.unexpectedKeyError(l)
          }
        } while (in.isNextToken(','));
        if (in.isCurrentToken('}').`unary_!`)
          in.objectEndOrCommaError()
        else
          ()
      } else
        ();
      if (p0.&(7).!=(0))
        in.requiredFieldError(r11(Integer.numberOfTrailingZeros(p0)))
      else
        ();
      new io.crossref.Update(updated = _updated, DOI = _DOI, `type` = _type, label = _label)
    } else
      in.readNullOrTokenError(default, '{');
  private[this] def d30(in: JsonReader, default: Seq[io.crossref.Update]): Seq[io.crossref.Update] =
    if (in.isNextToken('['))
      if (in.isNextToken(']'))
        default
      else {
        in.rollbackToken();
        val x = Seq.newBuilder[io.crossref.Update];
        do x.+=(d31(in, null)) while (in.isNextToken(','));
        if (in.isCurrentToken(']'))
          x.result()
        else
          in.arrayEndOrCommaError()
      } else
      in.readNullOrTokenError(default, '[');
  private[this] def d33(in: JsonReader, default: io.crossref.Link): io.crossref.Link =
    if (in.isNextToken('{')) {
      var _URL: String                    = null;
      var `_content-type`: String         = null;
      var `_content-version`: String      = null;
      var `_intended-application`: String = null;
      var p0                              = 15;
      if (in.isNextToken('}').`unary_!`) {
        in.rollbackToken();
        do {
          val l = in.readKeyAsCharBuf();
          (in.charBufToHashCode(l): @switch) match {
            case 84303 =>
              if (in.isCharBufEqualsTo(l, "URL")) {
                if (p0.&(1).!=(0))
                  p0.^=(1)
                else
                  in.duplicatedKeyError(l);
                _URL = in.readString(_URL)
              } else
                in.unexpectedKeyError(l)
            case 785670158 =>
              if (in.isCharBufEqualsTo(l, "content-type")) {
                if (p0.&(2).!=(0))
                  p0.^=(2)
                else
                  in.duplicatedKeyError(l);
                `_content-type` = in.readString(`_content-type`)
              } else
                in.unexpectedKeyError(l)
            case -467293308 =>
              if (in.isCharBufEqualsTo(l, "content-version")) {
                if (p0.&(4).!=(0))
                  p0.^=(4)
                else
                  in.duplicatedKeyError(l);
                `_content-version` = in.readString(`_content-version`)
              } else
                in.unexpectedKeyError(l)
            case 1252392622 =>
              if (in.isCharBufEqualsTo(l, "intended-application")) {
                if (p0.&(8).!=(0))
                  p0.^=(8)
                else
                  in.duplicatedKeyError(l);
                `_intended-application` = in.readString(`_intended-application`)
              } else
                in.unexpectedKeyError(l)
            case _ => in.unexpectedKeyError(l)
          }
        } while (in.isNextToken(','));
        if (in.isCurrentToken('}').`unary_!`)
          in.objectEndOrCommaError()
        else
          ()
      } else
        ();
      if (p0.&(15).!=(0))
        in.requiredFieldError(r12(Integer.numberOfTrailingZeros(p0)))
      else
        ();
      new io.crossref.Link(URL = _URL,
                           `content-type` = `_content-type`,
                           `content-version` = `_content-version`,
                           `intended-application` = `_intended-application`)
    } else
      in.readNullOrTokenError(default, '{');
  private[this] def d32(in: JsonReader, default: Seq[io.crossref.Link]): Seq[io.crossref.Link] =
    if (in.isNextToken('['))
      if (in.isNextToken(']'))
        default
      else {
        in.rollbackToken();
        val x = Seq.newBuilder[io.crossref.Link];
        do x.+=(d33(in, null)) while (in.isNextToken(','));
        if (in.isCurrentToken(']'))
          x.result()
        else
          in.arrayEndOrCommaError()
      } else
      in.readNullOrTokenError(default, '[');
  private[this] def d35(in: JsonReader, default: io.crossref.ClinicalTrialNumber): io.crossref.ClinicalTrialNumber =
    if (in.isNextToken('{')) {
      var `_clinical-trial-number`: String = null;
      var _registry: String                = null;
      var _type: Option[String]            = None;
      var p0                               = 7;
      if (in.isNextToken('}').`unary_!`) {
        in.rollbackToken();
        do {
          val l = in.readKeyAsCharBuf();
          (in.charBufToHashCode(l): @switch) match {
            case 151266906 =>
              if (in.isCharBufEqualsTo(l, "clinical-trial-number")) {
                if (p0.&(1).!=(0))
                  p0.^=(1)
                else
                  in.duplicatedKeyError(l);
                `_clinical-trial-number` = in.readString(`_clinical-trial-number`)
              } else
                in.unexpectedKeyError(l)
            case -690212803 =>
              if (in.isCharBufEqualsTo(l, "registry")) {
                if (p0.&(2).!=(0))
                  p0.^=(2)
                else
                  in.duplicatedKeyError(l);
                _registry = in.readString(_registry)
              } else
                in.unexpectedKeyError(l)
            case 3575610 =>
              if (in.isCharBufEqualsTo(l, "type")) {
                if (p0.&(4).!=(0))
                  p0.^=(4)
                else
                  in.duplicatedKeyError(l);
                _type = d6(in, _type)
              } else
                in.unexpectedKeyError(l)
            case _ => in.unexpectedKeyError(l)
          }
        } while (in.isNextToken(','));
        if (in.isCurrentToken('}').`unary_!`)
          in.objectEndOrCommaError()
        else
          ()
      } else
        ();
      if (p0.&(3).!=(0))
        in.requiredFieldError(r13(Integer.numberOfTrailingZeros(p0)))
      else
        ();
      new io.crossref.ClinicalTrialNumber(`clinical-trial-number` = `_clinical-trial-number`, registry = _registry, `type` = _type)
    } else
      in.readNullOrTokenError(default, '{');
  private[this] def d34(in: JsonReader, default: Seq[io.crossref.ClinicalTrialNumber]): Seq[io.crossref.ClinicalTrialNumber] =
    if (in.isNextToken('['))
      if (in.isNextToken(']'))
        default
      else {
        in.rollbackToken();
        val x = Seq.newBuilder[io.crossref.ClinicalTrialNumber];
        do x.+=(d35(in, null)) while (in.isNextToken(','));
        if (in.isCurrentToken(']'))
          x.result()
        else
          in.arrayEndOrCommaError()
      } else
      in.readNullOrTokenError(default, '[');
  private[this] def d39(in: JsonReader, default: io.crossref.JournalIssue): io.crossref.JournalIssue =
    if (in.isNextToken('{')) {
      var _issue: String = null;
      var p0             = 1;
      if (in.isNextToken('}').`unary_!`) {
        in.rollbackToken();
        do {
          val l = in.readKeyAsCharBuf();
          (in.charBufToHashCode(l): @switch) match {
            case 100509913 =>
              if (in.isCharBufEqualsTo(l, "issue")) {
                if (p0.&(1).!=(0))
                  p0.^=(1)
                else
                  in.duplicatedKeyError(l);
                _issue = in.readString(_issue)
              } else
                in.unexpectedKeyError(l)
            case _ => in.unexpectedKeyError(l)
          }
        } while (in.isNextToken(','));
        if (in.isCurrentToken('}').`unary_!`)
          in.objectEndOrCommaError()
        else
          ()
      } else
        ();
      if (p0.&(1).!=(0))
        in.requiredFieldError(r15(Integer.numberOfTrailingZeros(p0)))
      else
        ();
      new io.crossref.JournalIssue(issue = _issue)
    } else
      in.readNullOrTokenError(default, '{');
  private[this] def d38(in: JsonReader, default: Option[io.crossref.JournalIssue]): Option[io.crossref.JournalIssue] =
    if (in.isNextToken('n'))
      in.readNullOrError(default, "expected value or null")
    else {
      in.rollbackToken();
      Some(d39(in, null))
    };
  private[this] def d37(in: JsonReader, default: io.crossref.Reference): io.crossref.Reference =
    if (in.isNextToken('{')) {
      var _key: String                                       = null;
      var _author: Option[String]                            = None;
      var _issue: Option[String]                             = None;
      var _edition: Option[String]                           = None;
      var _component: Option[String]                         = None;
      var `_standard-designator`: Option[String]             = None;
      var `_standards-body`: Option[String]                  = None;
      var _unstructured: Option[String]                      = None;
      var `_article-title`: Option[String]                   = None;
      var `_series-title`: Option[String]                    = None;
      var `_volume-title`: Option[String]                    = None;
      var `_journal-issue`: Option[io.crossref.JournalIssue] = None;
      var _ISSN: Option[String]                              = None;
      var `_issn-type`: Option[String]                       = None;
      var _ISBN: Option[String]                              = None;
      var `_isbn-type`: Option[String]                       = None;
      var _volume: Option[String]                            = None;
      var `_first-page`: Option[String]                      = None;
      var _year: Option[String]                              = None;
      var `_journal-title`: Option[String]                   = None;
      var _DOI: Option[String]                               = None;
      var `_doi-asserted-by`: Option[String]                 = None;
      var p0                                                 = 4194303;
      if (in.isNextToken('}').`unary_!`) {
        in.rollbackToken();
        do {
          val l = in.readKeyAsCharBuf();
          (in.charBufToHashCode(l): @switch) match {
            case 106079 =>
              if (in.isCharBufEqualsTo(l, "key")) {
                if (p0.&(1).!=(0))
                  p0.^=(1)
                else
                  in.duplicatedKeyError(l);
                _key = in.readString(_key)
              } else
                in.unexpectedKeyError(l)
            case -1406328437 =>
              if (in.isCharBufEqualsTo(l, "author")) {
                if (p0.&(2).!=(0))
                  p0.^=(2)
                else
                  in.duplicatedKeyError(l);
                _author = d6(in, _author)
              } else
                in.unexpectedKeyError(l)
            case 100509913 =>
              if (in.isCharBufEqualsTo(l, "issue")) {
                if (p0.&(4).!=(0))
                  p0.^=(4)
                else
                  in.duplicatedKeyError(l);
                _issue = d6(in, _issue)
              } else
                in.unexpectedKeyError(l)
            case -1887963714 =>
              if (in.isCharBufEqualsTo(l, "edition")) {
                if (p0.&(8).!=(0))
                  p0.^=(8)
                else
                  in.duplicatedKeyError(l);
                _edition = d6(in, _edition)
              } else
                in.unexpectedKeyError(l)
            case -1399907075 =>
              if (in.isCharBufEqualsTo(l, "component")) {
                if (p0.&(16).!=(0))
                  p0.^=(16)
                else
                  in.duplicatedKeyError(l);
                _component = d6(in, _component)
              } else
                in.unexpectedKeyError(l)
            case 61026596 =>
              if (in.isCharBufEqualsTo(l, "standard-designator")) {
                if (p0.&(32).!=(0))
                  p0.^=(32)
                else
                  in.duplicatedKeyError(l);
                `_standard-designator` = d6(in, `_standard-designator`)
              } else
                in.unexpectedKeyError(l)
            case -1135736903 =>
              if (in.isCharBufEqualsTo(l, "standards-body")) {
                if (p0.&(64).!=(0))
                  p0.^=(64)
                else
                  in.duplicatedKeyError(l);
                `_standards-body` = d6(in, `_standards-body`)
              } else
                in.unexpectedKeyError(l)
            case -1988238166 =>
              if (in.isCharBufEqualsTo(l, "unstructured")) {
                if (p0.&(128).!=(0))
                  p0.^=(128)
                else
                  in.duplicatedKeyError(l);
                _unstructured = d6(in, _unstructured)
              } else
                in.unexpectedKeyError(l)
            case -768937279 =>
              if (in.isCharBufEqualsTo(l, "article-title")) {
                if (p0.&(256).!=(0))
                  p0.^=(256)
                else
                  in.duplicatedKeyError(l);
                `_article-title` = d6(in, `_article-title`)
              } else
                in.unexpectedKeyError(l)
            case -563134590 =>
              if (in.isCharBufEqualsTo(l, "series-title")) {
                if (p0.&(512).!=(0))
                  p0.^=(512)
                else
                  in.duplicatedKeyError(l);
                `_series-title` = d6(in, `_series-title`)
              } else
                in.unexpectedKeyError(l)
            case 1516364261 =>
              if (in.isCharBufEqualsTo(l, "volume-title")) {
                if (p0.&(1024).!=(0))
                  p0.^=(1024)
                else
                  in.duplicatedKeyError(l);
                `_volume-title` = d6(in, `_volume-title`)
              } else
                in.unexpectedKeyError(l)
            case -1557928253 =>
              if (in.isCharBufEqualsTo(l, "journal-issue")) {
                if (p0.&(2048).!=(0))
                  p0.^=(2048)
                else
                  in.duplicatedKeyError(l);
                `_journal-issue` = d38(in, `_journal-issue`)
              } else
                in.unexpectedKeyError(l)
            case 2257157 =>
              if (in.isCharBufEqualsTo(l, "ISSN")) {
                if (p0.&(4096).!=(0))
                  p0.^=(4096)
                else
                  in.duplicatedKeyError(l);
                _ISSN = d6(in, _ISSN)
              } else
                in.unexpectedKeyError(l)
            case -66383102 =>
              if (in.isCharBufEqualsTo(l, "issn-type")) {
                if (p0.&(8192).!=(0))
                  p0.^=(8192)
                else
                  in.duplicatedKeyError(l);
                `_issn-type` = d6(in, `_issn-type`)
              } else
                in.unexpectedKeyError(l)
            case 2256630 =>
              if (in.isCharBufEqualsTo(l, "ISBN")) {
                if (p0.&(16384).!=(0))
                  p0.^=(16384)
                else
                  in.duplicatedKeyError(l);
                _ISBN = d6(in, _ISBN)
              } else
                in.unexpectedKeyError(l)
            case 2025923505 =>
              if (in.isCharBufEqualsTo(l, "isbn-type")) {
                if (p0.&(32768).!=(0))
                  p0.^=(32768)
                else
                  in.duplicatedKeyError(l);
                `_isbn-type` = d6(in, `_isbn-type`)
              } else
                in.unexpectedKeyError(l)
            case -810883302 =>
              if (in.isCharBufEqualsTo(l, "volume")) {
                if (p0.&(65536).!=(0))
                  p0.^=(65536)
                else
                  in.duplicatedKeyError(l);
                _volume = d6(in, _volume)
              } else
                in.unexpectedKeyError(l)
            case -207102068 =>
              if (in.isCharBufEqualsTo(l, "first-page")) {
                if (p0.&(131072).!=(0))
                  p0.^=(131072)
                else
                  in.duplicatedKeyError(l);
                `_first-page` = d6(in, `_first-page`)
              } else
                in.unexpectedKeyError(l)
            case 3704893 =>
              if (in.isCharBufEqualsTo(l, "year")) {
                if (p0.&(262144).!=(0))
                  p0.^=(262144)
                else
                  in.duplicatedKeyError(l);
                _year = d6(in, _year)
              } else
                in.unexpectedKeyError(l)
            case -1548066750 =>
              if (in.isCharBufEqualsTo(l, "journal-title")) {
                if (p0.&(524288).!=(0))
                  p0.^=(524288)
                else
                  in.duplicatedKeyError(l);
                `_journal-title` = d6(in, `_journal-title`)
              } else
                in.unexpectedKeyError(l)
            case 67870 =>
              if (in.isCharBufEqualsTo(l, "DOI")) {
                if (p0.&(1048576).!=(0))
                  p0.^=(1048576)
                else
                  in.duplicatedKeyError(l);
                _DOI = d6(in, _DOI)
              } else
                in.unexpectedKeyError(l)
            case 1330102960 =>
              if (in.isCharBufEqualsTo(l, "doi-asserted-by")) {
                if (p0.&(2097152).!=(0))
                  p0.^=(2097152)
                else
                  in.duplicatedKeyError(l);
                `_doi-asserted-by` = d6(in, `_doi-asserted-by`)
              } else
                in.unexpectedKeyError(l)
            case _ => in.unexpectedKeyError(l)
          }
        } while (in.isNextToken(','));
        if (in.isCurrentToken('}').`unary_!`)
          in.objectEndOrCommaError()
        else
          ()
      } else
        ();
      if (p0.&(1).!=(0))
        in.requiredFieldError(r14(Integer.numberOfTrailingZeros(p0)))
      else
        ();
      new io.crossref.Reference(
        key = _key,
        author = _author,
        issue = _issue,
        edition = _edition,
        component = _component,
        `standard-designator` = `_standard-designator`,
        `standards-body` = `_standards-body`,
        unstructured = _unstructured,
        `article-title` = `_article-title`,
        `series-title` = `_series-title`,
        `volume-title` = `_volume-title`,
        `journal-issue` = `_journal-issue`,
        ISSN = _ISSN,
        `issn-type` = `_issn-type`,
        ISBN = _ISBN,
        `isbn-type` = `_isbn-type`,
        volume = _volume,
        `first-page` = `_first-page`,
        year = _year,
        `journal-title` = `_journal-title`,
        DOI = _DOI,
        `doi-asserted-by` = `_doi-asserted-by`
      )
    } else
      in.readNullOrTokenError(default, '{');
  private[this] def d36(in: JsonReader, default: Seq[io.crossref.Reference]): Seq[io.crossref.Reference] =
    if (in.isNextToken('['))
      if (in.isNextToken(']'))
        default
      else {
        in.rollbackToken();
        val x = Seq.newBuilder[io.crossref.Reference];
        do x.+=(d37(in, null)) while (in.isNextToken(','));
        if (in.isCurrentToken(']'))
          x.result()
        else
          in.arrayEndOrCommaError()
      } else
      in.readNullOrTokenError(default, '[');
  private[this] def d41(in: JsonReader, default: io.crossref.ContentDomain): io.crossref.ContentDomain =
    if (in.isNextToken('{')) {
      var _domain: Seq[String]              = Seq.empty[String];
      var `_crossmark-restriction`: Boolean = false;
      var p0                                = 3;
      if (in.isNextToken('}').`unary_!`) {
        in.rollbackToken();
        do {
          val l = in.readKeyAsCharBuf();
          (in.charBufToHashCode(l): @switch) match {
            case -1326197564 =>
              if (in.isCharBufEqualsTo(l, "domain")) {
                if (p0.&(1).!=(0))
                  p0.^=(1)
                else
                  in.duplicatedKeyError(l);
                _domain = d5(in, _domain)
              } else
                in.unexpectedKeyError(l)
            case 367294732 =>
              if (in.isCharBufEqualsTo(l, "crossmark-restriction")) {
                if (p0.&(2).!=(0))
                  p0.^=(2)
                else
                  in.duplicatedKeyError(l);
                `_crossmark-restriction` = in.readBoolean()
              } else
                in.unexpectedKeyError(l)
            case _ => in.unexpectedKeyError(l)
          }
        } while (in.isNextToken(','));
        if (in.isCurrentToken('}').`unary_!`)
          in.objectEndOrCommaError()
        else
          ()
      } else
        ();
      if (p0.&(2).!=(0))
        in.requiredFieldError(r16(Integer.numberOfTrailingZeros(p0)))
      else
        ();
      new io.crossref.ContentDomain(domain = _domain, `crossmark-restriction` = `_crossmark-restriction`)
    } else
      in.readNullOrTokenError(default, '{');
  private[this] def d40(in: JsonReader, default: Option[io.crossref.ContentDomain]): Option[io.crossref.ContentDomain] =
    if (in.isNextToken('n'))
      in.readNullOrError(default, "expected value or null")
    else {
      in.rollbackToken();
      Some(d41(in, null))
    };
  private[this] def d44(in: JsonReader, default: io.crossref.Relation): io.crossref.Relation =
    if (in.isNextToken('{')) {
      var `_id-type`: String     = null;
      var _id: String            = null;
      var `_asserted-by`: String = null;
      var p0                     = 7;
      if (in.isNextToken('}').`unary_!`) {
        in.rollbackToken();
        do {
          val l = in.readKeyAsCharBuf();
          (in.charBufToHashCode(l): @switch) match {
            case 1606655148 =>
              if (in.isCharBufEqualsTo(l, "id-type")) {
                if (p0.&(1).!=(0))
                  p0.^=(1)
                else
                  in.duplicatedKeyError(l);
                `_id-type` = in.readString(`_id-type`)
              } else
                in.unexpectedKeyError(l)
            case 3355 =>
              if (in.isCharBufEqualsTo(l, "id")) {
                if (p0.&(2).!=(0))
                  p0.^=(2)
                else
                  in.duplicatedKeyError(l);
                _id = in.readString(_id)
              } else
                in.unexpectedKeyError(l)
            case 409999551 =>
              if (in.isCharBufEqualsTo(l, "asserted-by")) {
                if (p0.&(4).!=(0))
                  p0.^=(4)
                else
                  in.duplicatedKeyError(l);
                `_asserted-by` = in.readString(`_asserted-by`)
              } else
                in.unexpectedKeyError(l)
            case _ => in.unexpectedKeyError(l)
          }
        } while (in.isNextToken(','));
        if (in.isCurrentToken('}').`unary_!`)
          in.objectEndOrCommaError()
        else
          ()
      } else
        ();
      if (p0.&(7).!=(0))
        in.requiredFieldError(r17(Integer.numberOfTrailingZeros(p0)))
      else
        ();
      new io.crossref.Relation(`id-type` = `_id-type`, id = _id, `asserted-by` = `_asserted-by`)
    } else
      in.readNullOrTokenError(default, '{');
  private[this] def d43(
      in: JsonReader,
      default: scala.collection.immutable.Map[String, io.crossref.Relation]): scala.collection.immutable.Map[String, io.crossref.Relation] =
    if (in.isNextToken('{'))
      if (in.isNextToken('}'))
        default
      else {
        in.rollbackToken();
        var x = Map.empty[String, io.crossref.Relation];
        do x = x.updated(in.readKeyAsString(), d44(in, null)) while (in.isNextToken(','));
        if (in.isCurrentToken('}'))
          x
        else
          in.objectEndOrCommaError()
      } else
      in.readNullOrTokenError(default, '{');
  private[this] def d42(in: JsonReader, default: Option[Map[String, io.crossref.Relation]]): Option[Map[String, io.crossref.Relation]] =
    if (in.isNextToken('n'))
      in.readNullOrError(default, "expected value or null")
    else {
      in.rollbackToken();
      Some(d43(in, Map.empty[String, io.crossref.Relation]))
    };
  private[this] def d4(in: JsonReader, default: io.crossref.Publication): io.crossref.Publication =
    if (in.isNextToken('{')) {
      var _publisher: String                                             = null;
      var _title: Seq[String]                                            = Seq.empty[String];
      var `_original-title`: Seq[String]                                 = Seq.empty[String];
      var `_short-title`: Seq[String]                                    = Seq.empty[String];
      var _abstract: Option[String]                                      = None;
      var `_reference-count`: Int                                        = 0;
      var `_references-count`: Int                                       = 0;
      var `_is-referenced-by-count`: Int                                 = 0;
      var _source: String                                                = null;
      var _prefix: String                                                = null;
      var _DOI: String                                                   = null;
      var _URL: String                                                   = null;
      var _member: String                                                = null;
      var _type: String                                                  = null;
      var _created: io.crossref.DateParts                                = null;
      var _deposited: io.crossref.DateParts                              = null;
      var _indexed: io.crossref.DateParts                                = null;
      var _issued: io.crossref.PartialDate                               = null;
      var _posted: Option[io.crossref.PartialDate]                       = None;
      var _accepted: Option[io.crossref.PartialDate]                     = None;
      var _subtitle: Seq[String]                                         = Seq.empty[String];
      var `_container-title`: Seq[String]                                = Seq.empty[String];
      var `_short-container-title`: Seq[String]                          = Seq.empty[String];
      var `_group-title`: Option[String]                                 = None;
      var _issue: Option[String]                                         = None;
      var _volume: Option[String]                                        = None;
      var _page: Option[String]                                          = None;
      var `_article-number`: Option[String]                              = None;
      var `_published-print`: Option[io.crossref.PartialDate]            = None;
      var `_published-online`: Option[io.crossref.PartialDate]           = None;
      var _subject: Seq[String]                                          = Seq.empty[String];
      var _ISSN: Seq[String]                                             = Seq.empty[String];
      var `_issn-type`: Seq[io.crossref.ISSNType]                        = Seq.empty[io.crossref.ISSNType];
      var _ISBN: Seq[String]                                             = Seq.empty[String];
      var _archive: Seq[String]                                          = Seq.empty[String];
      var _license: Seq[io.crossref.License]                             = Seq.empty[io.crossref.License];
      var _funder: Seq[io.crossref.Funder]                               = Seq.empty[io.crossref.Funder];
      var _assertion: Seq[io.crossref.Assertion]                         = Seq.empty[io.crossref.Assertion];
      var _author: Seq[io.crossref.Authors]                              = Seq.empty[io.crossref.Authors];
      var _editor: Seq[io.crossref.Contributor]                          = Seq.empty[io.crossref.Contributor];
      var _chair: Seq[io.crossref.Contributor]                           = Seq.empty[io.crossref.Contributor];
      var _translator: Seq[io.crossref.Contributor]                      = Seq.empty[io.crossref.Contributor];
      var `_update-to`: Seq[io.crossref.Update]                          = Seq.empty[io.crossref.Update];
      var `_update-policy`: Option[String]                               = None;
      var _link: Seq[io.crossref.Link]                                   = Seq.empty[io.crossref.Link];
      var `_clinical-trial-number`: Seq[io.crossref.ClinicalTrialNumber] = Seq.empty[io.crossref.ClinicalTrialNumber];
      var `_alternative-id`: Option[String]                              = None;
      var _reference: Seq[io.crossref.Reference]                         = Seq.empty[io.crossref.Reference];
      var `_content-domain`: Option[io.crossref.ContentDomain]           = None;
      var _relation: Option[Map[String, io.crossref.Relation]]           = None;
      var _score: Double                                                 = 0.0;
      var p0                                                             = -1;
      var p1                                                             = 524287;
      if (in.isNextToken('}').`unary_!`) {
        in.rollbackToken();
        do {
          val l = in.readKeyAsCharBuf();
          (in.charBufToHashCode(l): @switch) match {
            case 1447404028 =>
              if (in.isCharBufEqualsTo(l, "publisher")) {
                if (p0.&(1).!=(0))
                  p0.^=(1)
                else
                  in.duplicatedKeyError(l);
                _publisher = in.readString(_publisher)
              } else
                in.unexpectedKeyError(l)
            case 110371416 =>
              if (in.isCharBufEqualsTo(l, "title")) {
                if (p0.&(2).!=(0))
                  p0.^=(2)
                else
                  in.duplicatedKeyError(l);
                _title = d5(in, _title)
              } else
                in.unexpectedKeyError(l)
            case 498884444 =>
              if (in.isCharBufEqualsTo(l, "original-title")) {
                if (p0.&(4).!=(0))
                  p0.^=(4)
                else
                  in.duplicatedKeyError(l);
                `_original-title` = d5(in, `_original-title`)
              } else
                in.unexpectedKeyError(l)
            case -130716217 =>
              if (in.isCharBufEqualsTo(l, "short-title")) {
                if (p0.&(8).!=(0))
                  p0.^=(8)
                else
                  in.duplicatedKeyError(l);
                `_short-title` = d5(in, `_short-title`)
              } else
                in.unexpectedKeyError(l)
            case 1732898850 =>
              if (in.isCharBufEqualsTo(l, "abstract")) {
                if (p0.&(16).!=(0))
                  p0.^=(16)
                else
                  in.duplicatedKeyError(l);
                _abstract = d6(in, _abstract)
              } else
                in.unexpectedKeyError(l)
            case -216743923 =>
              if (in.isCharBufEqualsTo(l, "reference-count")) {
                if (p0.&(32).!=(0))
                  p0.^=(32)
                else
                  in.duplicatedKeyError(l);
                `_reference-count` = in.readInt()
              } else
                in.unexpectedKeyError(l)
            case -1985607286 =>
              if (in.isCharBufEqualsTo(l, "references-count")) {
                if (p0.&(64).!=(0))
                  p0.^=(64)
                else
                  in.duplicatedKeyError(l);
                `_references-count` = in.readInt()
              } else
                in.unexpectedKeyError(l)
            case -1152800822 =>
              if (in.isCharBufEqualsTo(l, "is-referenced-by-count")) {
                if (p0.&(128).!=(0))
                  p0.^=(128)
                else
                  in.duplicatedKeyError(l);
                `_is-referenced-by-count` = in.readInt()
              } else
                in.unexpectedKeyError(l)
            case -896505829 =>
              if (in.isCharBufEqualsTo(l, "source")) {
                if (p0.&(256).!=(0))
                  p0.^=(256)
                else
                  in.duplicatedKeyError(l);
                _source = in.readString(_source)
              } else
                in.unexpectedKeyError(l)
            case -980110702 =>
              if (in.isCharBufEqualsTo(l, "prefix")) {
                if (p0.&(512).!=(0))
                  p0.^=(512)
                else
                  in.duplicatedKeyError(l);
                _prefix = in.readString(_prefix)
              } else
                in.unexpectedKeyError(l)
            case 67870 =>
              if (in.isCharBufEqualsTo(l, "DOI")) {
                if (p0.&(1024).!=(0))
                  p0.^=(1024)
                else
                  in.duplicatedKeyError(l);
                _DOI = in.readString(_DOI)
              } else
                in.unexpectedKeyError(l)
            case 84303 =>
              if (in.isCharBufEqualsTo(l, "URL")) {
                if (p0.&(2048).!=(0))
                  p0.^=(2048)
                else
                  in.duplicatedKeyError(l);
                _URL = in.readString(_URL)
              } else
                in.unexpectedKeyError(l)
            case -1077769574 =>
              if (in.isCharBufEqualsTo(l, "member")) {
                if (p0.&(4096).!=(0))
                  p0.^=(4096)
                else
                  in.duplicatedKeyError(l);
                _member = in.readString(_member)
              } else
                in.unexpectedKeyError(l)
            case 3575610 =>
              if (in.isCharBufEqualsTo(l, "type")) {
                if (p0.&(8192).!=(0))
                  p0.^=(8192)
                else
                  in.duplicatedKeyError(l);
                _type = in.readString(_type)
              } else
                in.unexpectedKeyError(l)
            case 1028554472 =>
              if (in.isCharBufEqualsTo(l, "created")) {
                if (p0.&(16384).!=(0))
                  p0.^=(16384)
                else
                  in.duplicatedKeyError(l);
                _created = d7(in, _created)
              } else
                in.unexpectedKeyError(l)
            case -818154563 =>
              if (in.isCharBufEqualsTo(l, "deposited")) {
                if (p0.&(32768).!=(0))
                  p0.^=(32768)
                else
                  in.duplicatedKeyError(l);
                _deposited = d7(in, _deposited)
              } else
                in.unexpectedKeyError(l)
            case 1943292145 =>
              if (in.isCharBufEqualsTo(l, "indexed")) {
                if (p0.&(65536).!=(0))
                  p0.^=(65536)
                else
                  in.duplicatedKeyError(l);
                _indexed = d7(in, _indexed)
              } else
                in.unexpectedKeyError(l)
            case -1179159893 =>
              if (in.isCharBufEqualsTo(l, "issued")) {
                if (p0.&(131072).!=(0))
                  p0.^=(131072)
                else
                  in.duplicatedKeyError(l);
                _issued = d10(in, _issued)
              } else
                in.unexpectedKeyError(l)
            case -982450881 =>
              if (in.isCharBufEqualsTo(l, "posted")) {
                if (p0.&(262144).!=(0))
                  p0.^=(262144)
                else
                  in.duplicatedKeyError(l);
                _posted = d11(in, _posted)
              } else
                in.unexpectedKeyError(l)
            case -2146525273 =>
              if (in.isCharBufEqualsTo(l, "accepted")) {
                if (p0.&(524288).!=(0))
                  p0.^=(524288)
                else
                  in.duplicatedKeyError(l);
                _accepted = d11(in, _accepted)
              } else
                in.unexpectedKeyError(l)
            case -2060497896 =>
              if (in.isCharBufEqualsTo(l, "subtitle")) {
                if (p0.&(1048576).!=(0))
                  p0.^=(1048576)
                else
                  in.duplicatedKeyError(l);
                _subtitle = d5(in, _subtitle)
              } else
                in.unexpectedKeyError(l)
            case -675652084 =>
              if (in.isCharBufEqualsTo(l, "container-title")) {
                if (p0.&(2097152).!=(0))
                  p0.^=(2097152)
                else
                  in.duplicatedKeyError(l);
                `_container-title` = d5(in, `_container-title`)
              } else
                in.unexpectedKeyError(l)
            case -2086442309 =>
              if (in.isCharBufEqualsTo(l, "short-container-title")) {
                if (p0.&(4194304).!=(0))
                  p0.^=(4194304)
                else
                  in.duplicatedKeyError(l);
                `_short-container-title` = d5(in, `_short-container-title`)
              } else
                in.unexpectedKeyError(l)
            case -328855158 =>
              if (in.isCharBufEqualsTo(l, "group-title")) {
                if (p0.&(8388608).!=(0))
                  p0.^=(8388608)
                else
                  in.duplicatedKeyError(l);
                `_group-title` = d6(in, `_group-title`)
              } else
                in.unexpectedKeyError(l)
            case 100509913 =>
              if (in.isCharBufEqualsTo(l, "issue")) {
                if (p0.&(16777216).!=(0))
                  p0.^=(16777216)
                else
                  in.duplicatedKeyError(l);
                _issue = d6(in, _issue)
              } else
                in.unexpectedKeyError(l)
            case -810883302 =>
              if (in.isCharBufEqualsTo(l, "volume")) {
                if (p0.&(33554432).!=(0))
                  p0.^=(33554432)
                else
                  in.duplicatedKeyError(l);
                _volume = d6(in, _volume)
              } else
                in.unexpectedKeyError(l)
            case 3433103 =>
              if (in.isCharBufEqualsTo(l, "page")) {
                if (p0.&(67108864).!=(0))
                  p0.^=(67108864)
                else
                  in.duplicatedKeyError(l);
                _page = d6(in, _page)
              } else
                in.unexpectedKeyError(l)
            case 1771837440 =>
              if (in.isCharBufEqualsTo(l, "article-number")) {
                if (p0.&(134217728).!=(0))
                  p0.^=(134217728)
                else
                  in.duplicatedKeyError(l);
                `_article-number` = d6(in, `_article-number`)
              } else
                in.unexpectedKeyError(l)
            case 452836878 =>
              if (in.isCharBufEqualsTo(l, "published-print")) {
                if (p0.&(268435456).!=(0))
                  p0.^=(268435456)
                else
                  in.duplicatedKeyError(l);
                `_published-print` = d11(in, `_published-print`)
              } else
                in.unexpectedKeyError(l)
            case 1120802578 =>
              if (in.isCharBufEqualsTo(l, "published-online")) {
                if (p0.&(536870912).!=(0))
                  p0.^=(536870912)
                else
                  in.duplicatedKeyError(l);
                `_published-online` = d11(in, `_published-online`)
              } else
                in.unexpectedKeyError(l)
            case -1867885268 =>
              if (in.isCharBufEqualsTo(l, "subject")) {
                if (p0.&(1073741824).!=(0))
                  p0.^=(1073741824)
                else
                  in.duplicatedKeyError(l);
                _subject = d5(in, _subject)
              } else
                in.unexpectedKeyError(l)
            case 2257157 =>
              if (in.isCharBufEqualsTo(l, "ISSN")) {
                if (p0.&(-2147483648).!=(0))
                  p0.^=(-2147483648)
                else
                  in.duplicatedKeyError(l);
                _ISSN = d5(in, _ISSN)
              } else
                in.unexpectedKeyError(l)
            case -66383102 =>
              if (in.isCharBufEqualsTo(l, "issn-type")) {
                if (p1.&(1).!=(0))
                  p1.^=(1)
                else
                  in.duplicatedKeyError(l);
                `_issn-type` = d12(in, `_issn-type`)
              } else
                in.unexpectedKeyError(l)
            case 2256630 =>
              if (in.isCharBufEqualsTo(l, "ISBN")) {
                if (p1.&(2).!=(0))
                  p1.^=(2)
                else
                  in.duplicatedKeyError(l);
                _ISBN = d5(in, _ISBN)
              } else
                in.unexpectedKeyError(l)
            case -748101438 =>
              if (in.isCharBufEqualsTo(l, "archive")) {
                if (p1.&(4).!=(0))
                  p1.^=(4)
                else
                  in.duplicatedKeyError(l);
                _archive = d5(in, _archive)
              } else
                in.unexpectedKeyError(l)
            case 166757441 =>
              if (in.isCharBufEqualsTo(l, "license")) {
                if (p1.&(8).!=(0))
                  p1.^=(8)
                else
                  in.duplicatedKeyError(l);
                _license = d14(in, _license)
              } else
                in.unexpectedKeyError(l)
            case -1263365582 =>
              if (in.isCharBufEqualsTo(l, "funder")) {
                if (p1.&(16).!=(0))
                  p1.^=(16)
                else
                  in.duplicatedKeyError(l);
                _funder = d16(in, _funder)
              } else
                in.unexpectedKeyError(l)
            case 1314395906 =>
              if (in.isCharBufEqualsTo(l, "assertion")) {
                if (p1.&(32).!=(0))
                  p1.^=(32)
                else
                  in.duplicatedKeyError(l);
                _assertion = d18(in, _assertion)
              } else
                in.unexpectedKeyError(l)
            case -1406328437 =>
              if (in.isCharBufEqualsTo(l, "author")) {
                if (p1.&(64).!=(0))
                  p1.^=(64)
                else
                  in.duplicatedKeyError(l);
                _author = d23(in, _author)
              } else
                in.unexpectedKeyError(l)
            case -1307827859 =>
              if (in.isCharBufEqualsTo(l, "editor")) {
                if (p1.&(128).!=(0))
                  p1.^=(128)
                else
                  in.duplicatedKeyError(l);
                _editor = d27(in, _editor)
              } else
                in.unexpectedKeyError(l)
            case 94623429 =>
              if (in.isCharBufEqualsTo(l, "chair")) {
                if (p1.&(256).!=(0))
                  p1.^=(256)
                else
                  in.duplicatedKeyError(l);
                _chair = d27(in, _chair)
              } else
                in.unexpectedKeyError(l)
            case -1721943526 =>
              if (in.isCharBufEqualsTo(l, "translator")) {
                if (p1.&(512).!=(0))
                  p1.^=(512)
                else
                  in.duplicatedKeyError(l);
                _translator = d27(in, _translator)
              } else
                in.unexpectedKeyError(l)
            case -1949245953 =>
              if (in.isCharBufEqualsTo(l, "update-to")) {
                if (p1.&(1024).!=(0))
                  p1.^=(1024)
                else
                  in.duplicatedKeyError(l);
                `_update-to` = d30(in, `_update-to`)
              } else
                in.unexpectedKeyError(l)
            case 1434653366 =>
              if (in.isCharBufEqualsTo(l, "update-policy")) {
                if (p1.&(2048).!=(0))
                  p1.^=(2048)
                else
                  in.duplicatedKeyError(l);
                `_update-policy` = d6(in, `_update-policy`)
              } else
                in.unexpectedKeyError(l)
            case 3321850 =>
              if (in.isCharBufEqualsTo(l, "link")) {
                if (p1.&(4096).!=(0))
                  p1.^=(4096)
                else
                  in.duplicatedKeyError(l);
                _link = d32(in, _link)
              } else
                in.unexpectedKeyError(l)
            case 151266906 =>
              if (in.isCharBufEqualsTo(l, "clinical-trial-number")) {
                if (p1.&(8192).!=(0))
                  p1.^=(8192)
                else
                  in.duplicatedKeyError(l);
                `_clinical-trial-number` = d34(in, `_clinical-trial-number`)
              } else
                in.unexpectedKeyError(l)
            case -73084101 =>
              if (in.isCharBufEqualsTo(l, "alternative-id")) {
                if (p1.&(16384).!=(0))
                  p1.^=(16384)
                else
                  in.duplicatedKeyError(l);
                `_alternative-id` = d6(in, `_alternative-id`)
              } else
                in.unexpectedKeyError(l)
            case -925155509 =>
              if (in.isCharBufEqualsTo(l, "reference")) {
                if (p1.&(32768).!=(0))
                  p1.^=(32768)
                else
                  in.duplicatedKeyError(l);
                _reference = d36(in, _reference)
              } else
                in.unexpectedKeyError(l)
            case -1352613736 =>
              if (in.isCharBufEqualsTo(l, "content-domain")) {
                if (p1.&(65536).!=(0))
                  p1.^=(65536)
                else
                  in.duplicatedKeyError(l);
                `_content-domain` = d40(in, `_content-domain`)
              } else
                in.unexpectedKeyError(l)
            case -554436100 =>
              if (in.isCharBufEqualsTo(l, "relation")) {
                if (p1.&(131072).!=(0))
                  p1.^=(131072)
                else
                  in.duplicatedKeyError(l);
                _relation = d42(in, _relation)
              } else
                in.unexpectedKeyError(l)
            case 109264530 =>
              if (in.isCharBufEqualsTo(l, "score")) {
                if (p1.&(262144).!=(0))
                  p1.^=(262144)
                else
                  in.duplicatedKeyError(l);
                _score = in.readDouble()
              } else
                in.unexpectedKeyError(l)
            case _ => in.unexpectedKeyError(l)
          }
        } while (in.isNextToken(','));
        if (in.isCurrentToken('}').`unary_!`)
          in.objectEndOrCommaError()
        else
          ()
      } else
        ();
      if (p0.&(262113).!=(0))
        in.requiredFieldError(r2(Integer.numberOfTrailingZeros(p0)))
      else
        ();
      if (p1.&(262144).!=(0))
        in.requiredFieldError(r2(Integer.numberOfTrailingZeros(p1).+(32)))
      else
        ();
      new io.crossref.Publication(
        publisher = _publisher,
        title = _title,
        `original-title` = `_original-title`,
        `short-title` = `_short-title`,
        `abstract` = _abstract,
        `reference-count` = `_reference-count`,
        `references-count` = `_references-count`,
        `is-referenced-by-count` = `_is-referenced-by-count`,
        source = _source,
        prefix = _prefix,
        DOI = _DOI,
        URL = _URL,
        member = _member,
        `type` = _type,
        created = _created,
        deposited = _deposited,
        indexed = _indexed,
        issued = _issued,
        posted = _posted,
        accepted = _accepted,
        subtitle = _subtitle,
        `container-title` = `_container-title`,
        `short-container-title` = `_short-container-title`,
        `group-title` = `_group-title`,
        issue = _issue,
        volume = _volume,
        page = _page,
        `article-number` = `_article-number`,
        `published-print` = `_published-print`,
        `published-online` = `_published-online`,
        subject = _subject,
        ISSN = _ISSN,
        `issn-type` = `_issn-type`,
        ISBN = _ISBN,
        archive = _archive,
        license = _license,
        funder = _funder,
        assertion = _assertion,
        author = _author,
        editor = _editor,
        chair = _chair,
        translator = _translator,
        `update-to` = `_update-to`,
        `update-policy` = `_update-policy`,
        link = _link,
        `clinical-trial-number` = `_clinical-trial-number`,
        `alternative-id` = `_alternative-id`,
        reference = _reference,
        `content-domain` = `_content-domain`,
        relation = _relation,
        score = _score
      )
    } else
      in.readNullOrTokenError(default, '{');
  private[this] def d3(in: JsonReader, default: Seq[io.crossref.Publication]): Seq[io.crossref.Publication] =
    if (in.isNextToken('['))
      if (in.isNextToken(']'))
        default
      else {
        in.rollbackToken();
        val x = Seq.newBuilder[io.crossref.Publication];
        do x.+=(d4(in, null)) while (in.isNextToken(','));
        if (in.isCurrentToken(']'))
          x.result()
        else
          in.arrayEndOrCommaError()
      } else
      in.readNullOrTokenError(default, '[');
  private[this] def d45(in: JsonReader, default: io.crossref.Query): io.crossref.Query =
    if (in.isNextToken('{')) {
      var `_start-index`: Int             = 0;
      var `_search-terms`: Option[String] = None;
      var p0                              = 3;
      if (in.isNextToken('}').`unary_!`) {
        in.rollbackToken();
        do {
          val l = in.readKeyAsCharBuf();
          (in.charBufToHashCode(l): @switch) match {
            case 1330622375 =>
              if (in.isCharBufEqualsTo(l, "start-index")) {
                if (p0.&(1).!=(0))
                  p0.^=(1)
                else
                  in.duplicatedKeyError(l);
                `_start-index` = in.readInt()
              } else
                in.unexpectedKeyError(l)
            case -967973598 =>
              if (in.isCharBufEqualsTo(l, "search-terms")) {
                if (p0.&(2).!=(0))
                  p0.^=(2)
                else
                  in.duplicatedKeyError(l);
                `_search-terms` = d6(in, `_search-terms`)
              } else
                in.unexpectedKeyError(l)
            case _ => in.unexpectedKeyError(l)
          }
        } while (in.isNextToken(','));
        if (in.isCurrentToken('}').`unary_!`)
          in.objectEndOrCommaError()
        else
          ()
      } else
        ();
      if (p0.&(1).!=(0))
        in.requiredFieldError(r18(Integer.numberOfTrailingZeros(p0)))
      else
        ();
      new io.crossref.Query(`start-index` = `_start-index`, `search-terms` = `_search-terms`)
    } else
      in.readNullOrTokenError(default, '{');
  private[this] def d1(in: JsonReader, default: io.crossref.Items): io.crossref.Items =
    if (in.isNextToken('{')) {
      var _facets: scala.collection.immutable.Map[String, String] = Map.empty[String, String];
      var `_total-results`: Long                                  = 0L;
      var _items: Seq[io.crossref.Publication]                    = Seq.empty[io.crossref.Publication];
      var `_items-per-page`: Int                                  = 0;
      var _query: io.crossref.Query                               = null;
      var `_next-cursor`: Option[String]                          = None;
      var p0                                                      = 63;
      if (in.isNextToken('}').`unary_!`) {
        in.rollbackToken();
        do {
          val l = in.readKeyAsCharBuf();
          (in.charBufToHashCode(l): @switch) match {
            case -1282162276 =>
              if (in.isCharBufEqualsTo(l, "facets")) {
                if (p0.&(1).!=(0))
                  p0.^=(1)
                else
                  in.duplicatedKeyError(l);
                _facets = d2(in, _facets)
              } else
                in.unexpectedKeyError(l)
            case -2118551955 =>
              if (in.isCharBufEqualsTo(l, "total-results")) {
                if (p0.&(2).!=(0))
                  p0.^=(2)
                else
                  in.duplicatedKeyError(l);
                `_total-results` = in.readLong()
              } else
                in.unexpectedKeyError(l)
            case 100526016 =>
              if (in.isCharBufEqualsTo(l, "items")) {
                if (p0.&(4).!=(0))
                  p0.^=(4)
                else
                  in.duplicatedKeyError(l);
                _items = d3(in, _items)
              } else
                in.unexpectedKeyError(l)
            case 157438124 =>
              if (in.isCharBufEqualsTo(l, "items-per-page")) {
                if (p0.&(8).!=(0))
                  p0.^=(8)
                else
                  in.duplicatedKeyError(l);
                `_items-per-page` = in.readInt()
              } else
                in.unexpectedKeyError(l)
            case 107944136 =>
              if (in.isCharBufEqualsTo(l, "query")) {
                if (p0.&(16).!=(0))
                  p0.^=(16)
                else
                  in.duplicatedKeyError(l);
                _query = d45(in, _query)
              } else
                in.unexpectedKeyError(l)
            case -378975376 =>
              if (in.isCharBufEqualsTo(l, "next-cursor")) {
                if (p0.&(32).!=(0))
                  p0.^=(32)
                else
                  in.duplicatedKeyError(l);
                `_next-cursor` = d6(in, `_next-cursor`)
              } else
                in.unexpectedKeyError(l)
            case _ => in.unexpectedKeyError(l)
          }
        } while (in.isNextToken(','));
        if (in.isCurrentToken('}').`unary_!`)
          in.objectEndOrCommaError()
        else
          ()
      } else
        ();
      if (p0.&(26).!=(0))
        in.requiredFieldError(r1(Integer.numberOfTrailingZeros(p0)))
      else
        ();
      new io.crossref.Items(facets = _facets,
                            `total-results` = `_total-results`,
                            items = _items,
                            `items-per-page` = `_items-per-page`,
                            query = _query,
                            `next-cursor` = `_next-cursor`)
    } else
      in.readNullOrTokenError(default, '{');
  private[this] def d0(in: JsonReader, default: io.crossref.ItemResponse): io.crossref.ItemResponse =
    if (in.isNextToken('{')) {
      var _status: String             = null;
      var `_message-type`: String     = null;
      var `_message-version`: String  = null;
      var _message: io.crossref.Items = null;
      var p0                          = 15;
      if (in.isNextToken('}').`unary_!`) {
        in.rollbackToken();
        do {
          val l = in.readKeyAsCharBuf();
          (in.charBufToHashCode(l): @switch) match {
            case -892481550 =>
              if (in.isCharBufEqualsTo(l, "status")) {
                if (p0.&(1).!=(0))
                  p0.^=(1)
                else
                  in.duplicatedKeyError(l);
                _status = in.readString(_status)
              } else
                in.unexpectedKeyError(l)
            case -1332241088 =>
              if (in.isCharBufEqualsTo(l, "message-type")) {
                if (p0.&(2).!=(0))
                  p0.^=(2)
                else
                  in.duplicatedKeyError(l);
                `_message-type` = in.readString(`_message-type`)
              } else
                in.unexpectedKeyError(l)
            case -2091644654 =>
              if (in.isCharBufEqualsTo(l, "message-version")) {
                if (p0.&(4).!=(0))
                  p0.^=(4)
                else
                  in.duplicatedKeyError(l);
                `_message-version` = in.readString(`_message-version`)
              } else
                in.unexpectedKeyError(l)
            case 954925063 =>
              if (in.isCharBufEqualsTo(l, "message")) {
                if (p0.&(8).!=(0))
                  p0.^=(8)
                else
                  in.duplicatedKeyError(l);
                _message = d1(in, _message)
              } else
                in.unexpectedKeyError(l)
            case _ => in.unexpectedKeyError(l)
          }
        } while (in.isNextToken(','));
        if (in.isCurrentToken('}').`unary_!`)
          in.objectEndOrCommaError()
        else
          ()
      } else
        ();
      if (p0.&(15).!=(0))
        in.requiredFieldError(r0(Integer.numberOfTrailingZeros(p0)))
      else
        ();
      new io.crossref.ItemResponse(status = _status,
                                   `message-type` = `_message-type`,
                                   `message-version` = `_message-version`,
                                   message = _message)
    } else
      in.readNullOrTokenError(default, '{');
  private[this] def e2(x: scala.collection.immutable.Map[String, String], out: JsonWriter): Unit = {
    out.writeObjectStart();
    x.foreach(((kv) => {
      out.writeKey(kv._1);
      out.writeVal(kv._2)
    }));
    out.writeObjectEnd()
  };
  private[this] def e5(x: Seq[String], out: JsonWriter): Unit = {
    out.writeArrayStart();
    x.foreach(((x) => {
      out.writeComma();
      out.writeVal(x)
    }));
    out.writeArrayEnd()
  };
  private[this] def e8(x: Array[Int], out: JsonWriter): Unit = {
    out.writeArrayStart();
    val l = x.length;
    var i = 0;
    while (i.<(l)) {
      out.writeComma();
      out.writeVal(x(i));
      i.+=(1)
    };
    out.writeArrayEnd()
  };
  private[this] def e7(x: Array[Array[Int]], out: JsonWriter): Unit = {
    out.writeArrayStart();
    val l = x.length;
    var i = 0;
    while (i.<(l)) {
      out.writeComma();
      e8(x(i), out);
      i.+=(1)
    };
    out.writeArrayEnd()
  };
  private[this] def e6(x: io.crossref.DateParts, out: JsonWriter): Unit = {
    out.writeObjectStart();
    {
      val v = x.`date-parts`;
      if (v.length.>(0)) {
        out.writeNonEscapedAsciiKey("date-parts");
        e7(v, out)
      } else
        ()
    };
    {
      out.writeNonEscapedAsciiKey("date-time");
      out.writeVal(x.`date-time`)
    };
    {
      out.writeNonEscapedAsciiKey("timestamp");
      out.writeVal(x.timestamp)
    };
    out.writeObjectEnd()
  };
  private[this] def e9(x: io.crossref.PartialDate, out: JsonWriter): Unit = {
    out.writeObjectStart();
    {
      val v = x.`date-parts`;
      if (v.length.>(0)) {
        out.writeNonEscapedAsciiKey("date-parts");
        e7(v, out)
      } else
        ()
    };
    out.writeObjectEnd()
  };
  private[this] def e11(x: io.crossref.ISSNType, out: JsonWriter): Unit = {
    out.writeObjectStart();
    {
      out.writeNonEscapedAsciiKey("value");
      out.writeVal(x.value)
    };
    {
      out.writeNonEscapedAsciiKey("type");
      out.writeVal(x.`type`)
    };
    out.writeObjectEnd()
  };
  private[this] def e10(x: Seq[io.crossref.ISSNType], out: JsonWriter): Unit = {
    out.writeArrayStart();
    x.foreach(((x) => {
      out.writeComma();
      e11(x, out)
    }));
    out.writeArrayEnd()
  };
  private[this] def e13(x: io.crossref.License, out: JsonWriter): Unit = {
    out.writeObjectStart();
    {
      out.writeNonEscapedAsciiKey("content-version");
      out.writeVal(x.`content-version`)
    };
    {
      out.writeNonEscapedAsciiKey("delay-in-days");
      out.writeVal(x.`delay-in-days`)
    };
    {
      out.writeNonEscapedAsciiKey("start");
      e6(x.start, out)
    };
    {
      out.writeNonEscapedAsciiKey("URL");
      out.writeVal(x.URL)
    };
    out.writeObjectEnd()
  };
  private[this] def e12(x: Seq[io.crossref.License], out: JsonWriter): Unit = {
    out.writeArrayStart();
    x.foreach(((x) => {
      out.writeComma();
      e13(x, out)
    }));
    out.writeArrayEnd()
  };
  private[this] def e15(x: io.crossref.Funder, out: JsonWriter): Unit = {
    out.writeObjectStart();
    {
      out.writeNonEscapedAsciiKey("name");
      out.writeVal(x.name)
    };
    {
      val v = x.DOI;
      if (v.isEmpty.`unary_!`) {
        out.writeNonEscapedAsciiKey("DOI");
        out.writeVal(v.get)
      } else
        ()
    };
    {
      val v = x.award;
      if (v.isEmpty.`unary_!`) {
        out.writeNonEscapedAsciiKey("award");
        e5(v, out)
      } else
        ()
    };
    {
      val v = x.`doi-asserted-by`;
      if (v.isEmpty.`unary_!`) {
        out.writeNonEscapedAsciiKey("doi-asserted-by");
        out.writeVal(v.get)
      } else
        ()
    };
    out.writeObjectEnd()
  };
  private[this] def e14(x: Seq[io.crossref.Funder], out: JsonWriter): Unit = {
    out.writeArrayStart();
    x.foreach(((x) => {
      out.writeComma();
      e15(x, out)
    }));
    out.writeArrayEnd()
  };
  private[this] def e18(x: io.crossref.AssertionGroup, out: JsonWriter): Unit = {
    out.writeObjectStart();
    {
      out.writeNonEscapedAsciiKey("name");
      out.writeVal(x.name)
    };
    {
      val v = x.label;
      if (v.isEmpty.`unary_!`) {
        out.writeNonEscapedAsciiKey("label");
        out.writeVal(v.get)
      } else
        ()
    };
    out.writeObjectEnd()
  };
  private[this] def e17(x: io.crossref.Assertion, out: JsonWriter): Unit = {
    out.writeObjectStart();
    {
      out.writeNonEscapedAsciiKey("name");
      out.writeVal(x.name)
    };
    {
      out.writeNonEscapedAsciiKey("value");
      out.writeVal(x.value)
    };
    {
      val v = x.URL;
      if (v.isEmpty.`unary_!`) {
        out.writeNonEscapedAsciiKey("URL");
        out.writeVal(v.get)
      } else
        ()
    };
    {
      val v = x.explanation;
      if (v.isEmpty.`unary_!`) {
        out.writeNonEscapedAsciiKey("explanation");
        out.writeVal(v.get)
      } else
        ()
    };
    {
      val v = x.label;
      if (v.isEmpty.`unary_!`) {
        out.writeNonEscapedAsciiKey("label");
        out.writeVal(v.get)
      } else
        ()
    };
    {
      val v = x.order;
      if (v.isEmpty.`unary_!`) {
        out.writeNonEscapedAsciiKey("order");
        out.writeVal(v.get)
      } else
        ()
    };
    {
      val v = x.group;
      if (v.isEmpty.`unary_!`) {
        out.writeNonEscapedAsciiKey("group");
        e18(v.get, out)
      } else
        ()
    };
    out.writeObjectEnd()
  };
  private[this] def e16(x: Seq[io.crossref.Assertion], out: JsonWriter): Unit = {
    out.writeArrayStart();
    x.foreach(((x) => {
      out.writeComma();
      e17(x, out)
    }));
    out.writeArrayEnd()
  };
  private[this] def e22(x: io.crossref.Affiliation, out: JsonWriter): Unit = {
    out.writeObjectStart();
    {
      out.writeNonEscapedAsciiKey("name");
      out.writeVal(x.name)
    };
    out.writeObjectEnd()
  };
  private[this] def e21(x: Seq[io.crossref.Affiliation], out: JsonWriter): Unit = {
    out.writeArrayStart();
    x.foreach(((x) => {
      out.writeComma();
      e22(x, out)
    }));
    out.writeArrayEnd()
  };
  private[this] def e20(x: io.crossref.Authors, out: JsonWriter): Unit = {
    out.writeObjectStart();
    {
      val v = x.given;
      if (v.isEmpty.`unary_!`) {
        out.writeNonEscapedAsciiKey("given");
        out.writeVal(v.get)
      } else
        ()
    };
    {
      val v = x.family;
      if (v.isEmpty.`unary_!`) {
        out.writeNonEscapedAsciiKey("family");
        out.writeVal(v.get)
      } else
        ()
    };
    {
      val v = x.affiliation;
      if (v.isEmpty.`unary_!`) {
        out.writeNonEscapedAsciiKey("affiliation");
        e21(v, out)
      } else
        ()
    };
    out.writeObjectEnd()
  };
  private[this] def e19(x: Seq[io.crossref.Authors], out: JsonWriter): Unit = {
    out.writeArrayStart();
    x.foreach(((x) => {
      out.writeComma();
      e20(x, out)
    }));
    out.writeArrayEnd()
  };
  private[this] def e24(x: io.crossref.Contributor, out: JsonWriter): Unit = {
    out.writeObjectStart();
    {
      out.writeNonEscapedAsciiKey("family");
      out.writeVal(x.family)
    };
    {
      val v = x.given;
      if (v.isEmpty.`unary_!`) {
        out.writeNonEscapedAsciiKey("given");
        out.writeVal(v.get)
      } else
        ()
    };
    {
      val v = x.ORCID;
      if (v.isEmpty.`unary_!`) {
        out.writeNonEscapedAsciiKey("ORCID");
        out.writeVal(v.get)
      } else
        ()
    };
    {
      val v = x.`authenticated-orcid`;
      if (v.isEmpty.`unary_!`) {
        out.writeNonEscapedAsciiKey("authenticated-orcid");
        out.writeVal(v.get)
      } else
        ()
    };
    {
      val v = x.affiliation;
      if (v.isEmpty.`unary_!`) {
        out.writeNonEscapedAsciiKey("affiliation");
        e21(v, out)
      } else
        ()
    };
    out.writeObjectEnd()
  };
  private[this] def e23(x: Seq[io.crossref.Contributor], out: JsonWriter): Unit = {
    out.writeArrayStart();
    x.foreach(((x) => {
      out.writeComma();
      e24(x, out)
    }));
    out.writeArrayEnd()
  };
  private[this] def e26(x: io.crossref.Update, out: JsonWriter): Unit = {
    out.writeObjectStart();
    {
      out.writeNonEscapedAsciiKey("updated");
      e9(x.updated, out)
    };
    {
      out.writeNonEscapedAsciiKey("DOI");
      out.writeVal(x.DOI)
    };
    {
      out.writeNonEscapedAsciiKey("type");
      out.writeVal(x.`type`)
    };
    {
      val v = x.label;
      if (v.isEmpty.`unary_!`) {
        out.writeNonEscapedAsciiKey("label");
        out.writeVal(v.get)
      } else
        ()
    };
    out.writeObjectEnd()
  };
  private[this] def e25(x: Seq[io.crossref.Update], out: JsonWriter): Unit = {
    out.writeArrayStart();
    x.foreach(((x) => {
      out.writeComma();
      e26(x, out)
    }));
    out.writeArrayEnd()
  };
  private[this] def e28(x: io.crossref.Link, out: JsonWriter): Unit = {
    out.writeObjectStart();
    {
      out.writeNonEscapedAsciiKey("URL");
      out.writeVal(x.URL)
    };
    {
      out.writeNonEscapedAsciiKey("content-type");
      out.writeVal(x.`content-type`)
    };
    {
      out.writeNonEscapedAsciiKey("content-version");
      out.writeVal(x.`content-version`)
    };
    {
      out.writeNonEscapedAsciiKey("intended-application");
      out.writeVal(x.`intended-application`)
    };
    out.writeObjectEnd()
  };
  private[this] def e27(x: Seq[io.crossref.Link], out: JsonWriter): Unit = {
    out.writeArrayStart();
    x.foreach(((x) => {
      out.writeComma();
      e28(x, out)
    }));
    out.writeArrayEnd()
  };
  private[this] def e30(x: io.crossref.ClinicalTrialNumber, out: JsonWriter): Unit = {
    out.writeObjectStart();
    {
      out.writeNonEscapedAsciiKey("clinical-trial-number");
      out.writeVal(x.`clinical-trial-number`)
    };
    {
      out.writeNonEscapedAsciiKey("registry");
      out.writeVal(x.registry)
    };
    {
      val v = x.`type`;
      if (v.isEmpty.`unary_!`) {
        out.writeNonEscapedAsciiKey("type");
        out.writeVal(v.get)
      } else
        ()
    };
    out.writeObjectEnd()
  };
  private[this] def e29(x: Seq[io.crossref.ClinicalTrialNumber], out: JsonWriter): Unit = {
    out.writeArrayStart();
    x.foreach(((x) => {
      out.writeComma();
      e30(x, out)
    }));
    out.writeArrayEnd()
  };
  private[this] def e33(x: io.crossref.JournalIssue, out: JsonWriter): Unit = {
    out.writeObjectStart();
    {
      out.writeNonEscapedAsciiKey("issue");
      out.writeVal(x.issue)
    };
    out.writeObjectEnd()
  };
  private[this] def e32(x: io.crossref.Reference, out: JsonWriter): Unit = {
    out.writeObjectStart();
    {
      out.writeNonEscapedAsciiKey("key");
      out.writeVal(x.key)
    };
    {
      val v = x.author;
      if (v.isEmpty.`unary_!`) {
        out.writeNonEscapedAsciiKey("author");
        out.writeVal(v.get)
      } else
        ()
    };
    {
      val v = x.issue;
      if (v.isEmpty.`unary_!`) {
        out.writeNonEscapedAsciiKey("issue");
        out.writeVal(v.get)
      } else
        ()
    };
    {
      val v = x.edition;
      if (v.isEmpty.`unary_!`) {
        out.writeNonEscapedAsciiKey("edition");
        out.writeVal(v.get)
      } else
        ()
    };
    {
      val v = x.component;
      if (v.isEmpty.`unary_!`) {
        out.writeNonEscapedAsciiKey("component");
        out.writeVal(v.get)
      } else
        ()
    };
    {
      val v = x.`standard-designator`;
      if (v.isEmpty.`unary_!`) {
        out.writeNonEscapedAsciiKey("standard-designator");
        out.writeVal(v.get)
      } else
        ()
    };
    {
      val v = x.`standards-body`;
      if (v.isEmpty.`unary_!`) {
        out.writeNonEscapedAsciiKey("standards-body");
        out.writeVal(v.get)
      } else
        ()
    };
    {
      val v = x.unstructured;
      if (v.isEmpty.`unary_!`) {
        out.writeNonEscapedAsciiKey("unstructured");
        out.writeVal(v.get)
      } else
        ()
    };
    {
      val v = x.`article-title`;
      if (v.isEmpty.`unary_!`) {
        out.writeNonEscapedAsciiKey("article-title");
        out.writeVal(v.get)
      } else
        ()
    };
    {
      val v = x.`series-title`;
      if (v.isEmpty.`unary_!`) {
        out.writeNonEscapedAsciiKey("series-title");
        out.writeVal(v.get)
      } else
        ()
    };
    {
      val v = x.`volume-title`;
      if (v.isEmpty.`unary_!`) {
        out.writeNonEscapedAsciiKey("volume-title");
        out.writeVal(v.get)
      } else
        ()
    };
    {
      val v = x.`journal-issue`;
      if (v.isEmpty.`unary_!`) {
        out.writeNonEscapedAsciiKey("journal-issue");
        e33(v.get, out)
      } else
        ()
    };
    {
      val v = x.ISSN;
      if (v.isEmpty.`unary_!`) {
        out.writeNonEscapedAsciiKey("ISSN");
        out.writeVal(v.get)
      } else
        ()
    };
    {
      val v = x.`issn-type`;
      if (v.isEmpty.`unary_!`) {
        out.writeNonEscapedAsciiKey("issn-type");
        out.writeVal(v.get)
      } else
        ()
    };
    {
      val v = x.ISBN;
      if (v.isEmpty.`unary_!`) {
        out.writeNonEscapedAsciiKey("ISBN");
        out.writeVal(v.get)
      } else
        ()
    };
    {
      val v = x.`isbn-type`;
      if (v.isEmpty.`unary_!`) {
        out.writeNonEscapedAsciiKey("isbn-type");
        out.writeVal(v.get)
      } else
        ()
    };
    {
      val v = x.volume;
      if (v.isEmpty.`unary_!`) {
        out.writeNonEscapedAsciiKey("volume");
        out.writeVal(v.get)
      } else
        ()
    };
    {
      val v = x.`first-page`;
      if (v.isEmpty.`unary_!`) {
        out.writeNonEscapedAsciiKey("first-page");
        out.writeVal(v.get)
      } else
        ()
    };
    {
      val v = x.year;
      if (v.isEmpty.`unary_!`) {
        out.writeNonEscapedAsciiKey("year");
        out.writeVal(v.get)
      } else
        ()
    };
    {
      val v = x.`journal-title`;
      if (v.isEmpty.`unary_!`) {
        out.writeNonEscapedAsciiKey("journal-title");
        out.writeVal(v.get)
      } else
        ()
    };
    {
      val v = x.DOI;
      if (v.isEmpty.`unary_!`) {
        out.writeNonEscapedAsciiKey("DOI");
        out.writeVal(v.get)
      } else
        ()
    };
    {
      val v = x.`doi-asserted-by`;
      if (v.isEmpty.`unary_!`) {
        out.writeNonEscapedAsciiKey("doi-asserted-by");
        out.writeVal(v.get)
      } else
        ()
    };
    out.writeObjectEnd()
  };
  private[this] def e31(x: Seq[io.crossref.Reference], out: JsonWriter): Unit = {
    out.writeArrayStart();
    x.foreach(((x) => {
      out.writeComma();
      e32(x, out)
    }));
    out.writeArrayEnd()
  };
  private[this] def e34(x: io.crossref.ContentDomain, out: JsonWriter): Unit = {
    out.writeObjectStart();
    {
      val v = x.domain;
      if (v.isEmpty.`unary_!`) {
        out.writeNonEscapedAsciiKey("domain");
        e5(v, out)
      } else
        ()
    };
    {
      out.writeNonEscapedAsciiKey("crossmark-restriction");
      out.writeVal(x.`crossmark-restriction`)
    };
    out.writeObjectEnd()
  };
  private[this] def e36(x: io.crossref.Relation, out: JsonWriter): Unit = {
    out.writeObjectStart();
    {
      out.writeNonEscapedAsciiKey("id-type");
      out.writeVal(x.`id-type`)
    };
    {
      out.writeNonEscapedAsciiKey("id");
      out.writeVal(x.id)
    };
    {
      out.writeNonEscapedAsciiKey("asserted-by");
      out.writeVal(x.`asserted-by`)
    };
    out.writeObjectEnd()
  };
  private[this] def e35(x: scala.collection.immutable.Map[String, io.crossref.Relation], out: JsonWriter): Unit = {
    out.writeObjectStart();
    x.foreach(((kv) => {
      out.writeKey(kv._1);
      e36(kv._2, out)
    }));
    out.writeObjectEnd()
  };
  private[this] def e4(x: io.crossref.Publication, out: JsonWriter): Unit = {
    out.writeObjectStart();
    {
      out.writeNonEscapedAsciiKey("publisher");
      out.writeVal(x.publisher)
    };
    {
      val v = x.title;
      if (v.isEmpty.`unary_!`) {
        out.writeNonEscapedAsciiKey("title");
        e5(v, out)
      } else
        ()
    };
    {
      val v = x.`original-title`;
      if (v.isEmpty.`unary_!`) {
        out.writeNonEscapedAsciiKey("original-title");
        e5(v, out)
      } else
        ()
    };
    {
      val v = x.`short-title`;
      if (v.isEmpty.`unary_!`) {
        out.writeNonEscapedAsciiKey("short-title");
        e5(v, out)
      } else
        ()
    };
    {
      val v = x.`abstract`;
      if (v.isEmpty.`unary_!`) {
        out.writeNonEscapedAsciiKey("abstract");
        out.writeVal(v.get)
      } else
        ()
    };
    {
      out.writeNonEscapedAsciiKey("reference-count");
      out.writeVal(x.`reference-count`)
    };
    {
      out.writeNonEscapedAsciiKey("references-count");
      out.writeVal(x.`references-count`)
    };
    {
      out.writeNonEscapedAsciiKey("is-referenced-by-count");
      out.writeVal(x.`is-referenced-by-count`)
    };
    {
      out.writeNonEscapedAsciiKey("source");
      out.writeVal(x.source)
    };
    {
      out.writeNonEscapedAsciiKey("prefix");
      out.writeVal(x.prefix)
    };
    {
      out.writeNonEscapedAsciiKey("DOI");
      out.writeVal(x.DOI)
    };
    {
      out.writeNonEscapedAsciiKey("URL");
      out.writeVal(x.URL)
    };
    {
      out.writeNonEscapedAsciiKey("member");
      out.writeVal(x.member)
    };
    {
      out.writeNonEscapedAsciiKey("type");
      out.writeVal(x.`type`)
    };
    {
      out.writeNonEscapedAsciiKey("created");
      e6(x.created, out)
    };
    {
      out.writeNonEscapedAsciiKey("deposited");
      e6(x.deposited, out)
    };
    {
      out.writeNonEscapedAsciiKey("indexed");
      e6(x.indexed, out)
    };
    {
      out.writeNonEscapedAsciiKey("issued");
      e9(x.issued, out)
    };
    {
      val v = x.posted;
      if (v.isEmpty.`unary_!`) {
        out.writeNonEscapedAsciiKey("posted");
        e9(v.get, out)
      } else
        ()
    };
    {
      val v = x.accepted;
      if (v.isEmpty.`unary_!`) {
        out.writeNonEscapedAsciiKey("accepted");
        e9(v.get, out)
      } else
        ()
    };
    {
      val v = x.subtitle;
      if (v.isEmpty.`unary_!`) {
        out.writeNonEscapedAsciiKey("subtitle");
        e5(v, out)
      } else
        ()
    };
    {
      val v = x.`container-title`;
      if (v.isEmpty.`unary_!`) {
        out.writeNonEscapedAsciiKey("container-title");
        e5(v, out)
      } else
        ()
    };
    {
      val v = x.`short-container-title`;
      if (v.isEmpty.`unary_!`) {
        out.writeNonEscapedAsciiKey("short-container-title");
        e5(v, out)
      } else
        ()
    };
    {
      val v = x.`group-title`;
      if (v.isEmpty.`unary_!`) {
        out.writeNonEscapedAsciiKey("group-title");
        out.writeVal(v.get)
      } else
        ()
    };
    {
      val v = x.issue;
      if (v.isEmpty.`unary_!`) {
        out.writeNonEscapedAsciiKey("issue");
        out.writeVal(v.get)
      } else
        ()
    };
    {
      val v = x.volume;
      if (v.isEmpty.`unary_!`) {
        out.writeNonEscapedAsciiKey("volume");
        out.writeVal(v.get)
      } else
        ()
    };
    {
      val v = x.page;
      if (v.isEmpty.`unary_!`) {
        out.writeNonEscapedAsciiKey("page");
        out.writeVal(v.get)
      } else
        ()
    };
    {
      val v = x.`article-number`;
      if (v.isEmpty.`unary_!`) {
        out.writeNonEscapedAsciiKey("article-number");
        out.writeVal(v.get)
      } else
        ()
    };
    {
      val v = x.`published-print`;
      if (v.isEmpty.`unary_!`) {
        out.writeNonEscapedAsciiKey("published-print");
        e9(v.get, out)
      } else
        ()
    };
    {
      val v = x.`published-online`;
      if (v.isEmpty.`unary_!`) {
        out.writeNonEscapedAsciiKey("published-online");
        e9(v.get, out)
      } else
        ()
    };
    {
      val v = x.subject;
      if (v.isEmpty.`unary_!`) {
        out.writeNonEscapedAsciiKey("subject");
        e5(v, out)
      } else
        ()
    };
    {
      val v = x.ISSN;
      if (v.isEmpty.`unary_!`) {
        out.writeNonEscapedAsciiKey("ISSN");
        e5(v, out)
      } else
        ()
    };
    {
      val v = x.`issn-type`;
      if (v.isEmpty.`unary_!`) {
        out.writeNonEscapedAsciiKey("issn-type");
        e10(v, out)
      } else
        ()
    };
    {
      val v = x.ISBN;
      if (v.isEmpty.`unary_!`) {
        out.writeNonEscapedAsciiKey("ISBN");
        e5(v, out)
      } else
        ()
    };
    {
      val v = x.archive;
      if (v.isEmpty.`unary_!`) {
        out.writeNonEscapedAsciiKey("archive");
        e5(v, out)
      } else
        ()
    };
    {
      val v = x.license;
      if (v.isEmpty.`unary_!`) {
        out.writeNonEscapedAsciiKey("license");
        e12(v, out)
      } else
        ()
    };
    {
      val v = x.funder;
      if (v.isEmpty.`unary_!`) {
        out.writeNonEscapedAsciiKey("funder");
        e14(v, out)
      } else
        ()
    };
    {
      val v = x.assertion;
      if (v.isEmpty.`unary_!`) {
        out.writeNonEscapedAsciiKey("assertion");
        e16(v, out)
      } else
        ()
    };
    {
      val v = x.author;
      if (v.isEmpty.`unary_!`) {
        out.writeNonEscapedAsciiKey("author");
        e19(v, out)
      } else
        ()
    };
    {
      val v = x.editor;
      if (v.isEmpty.`unary_!`) {
        out.writeNonEscapedAsciiKey("editor");
        e23(v, out)
      } else
        ()
    };
    {
      val v = x.chair;
      if (v.isEmpty.`unary_!`) {
        out.writeNonEscapedAsciiKey("chair");
        e23(v, out)
      } else
        ()
    };
    {
      val v = x.translator;
      if (v.isEmpty.`unary_!`) {
        out.writeNonEscapedAsciiKey("translator");
        e23(v, out)
      } else
        ()
    };
    {
      val v = x.`update-to`;
      if (v.isEmpty.`unary_!`) {
        out.writeNonEscapedAsciiKey("update-to");
        e25(v, out)
      } else
        ()
    };
    {
      val v = x.`update-policy`;
      if (v.isEmpty.`unary_!`) {
        out.writeNonEscapedAsciiKey("update-policy");
        out.writeVal(v.get)
      } else
        ()
    };
    {
      val v = x.link;
      if (v.isEmpty.`unary_!`) {
        out.writeNonEscapedAsciiKey("link");
        e27(v, out)
      } else
        ()
    };
    {
      val v = x.`clinical-trial-number`;
      if (v.isEmpty.`unary_!`) {
        out.writeNonEscapedAsciiKey("clinical-trial-number");
        e29(v, out)
      } else
        ()
    };
    {
      val v = x.`alternative-id`;
      if (v.isEmpty.`unary_!`) {
        out.writeNonEscapedAsciiKey("alternative-id");
        out.writeVal(v.get)
      } else
        ()
    };
    {
      val v = x.reference;
      if (v.isEmpty.`unary_!`) {
        out.writeNonEscapedAsciiKey("reference");
        e31(v, out)
      } else
        ()
    };
    {
      val v = x.`content-domain`;
      if (v.isEmpty.`unary_!`) {
        out.writeNonEscapedAsciiKey("content-domain");
        e34(v.get, out)
      } else
        ()
    };
    {
      val v = x.relation;
      if (v.isEmpty.`unary_!`) {
        out.writeNonEscapedAsciiKey("relation");
        e35(v.get, out)
      } else
        ()
    };
    {
      out.writeNonEscapedAsciiKey("score");
      out.writeVal(x.score)
    };
    out.writeObjectEnd()
  };
  private[this] def e3(x: Seq[io.crossref.Publication], out: JsonWriter): Unit = {
    out.writeArrayStart();
    x.foreach(((x) => {
      out.writeComma();
      e4(x, out)
    }));
    out.writeArrayEnd()
  };
  private[this] def e37(x: io.crossref.Query, out: JsonWriter): Unit = {
    out.writeObjectStart();
    {
      out.writeNonEscapedAsciiKey("start-index");
      out.writeVal(x.`start-index`)
    };
    {
      val v = x.`search-terms`;
      if (v.isEmpty.`unary_!`) {
        out.writeNonEscapedAsciiKey("search-terms");
        out.writeVal(v.get)
      } else
        ()
    };
    out.writeObjectEnd()
  };
  private[this] def e1(x: io.crossref.Items, out: JsonWriter): Unit = {
    out.writeObjectStart();
    {
      val v = x.facets;
      if (v.isEmpty.`unary_!`) {
        out.writeNonEscapedAsciiKey("facets");
        e2(v, out)
      } else
        ()
    };
    {
      out.writeNonEscapedAsciiKey("total-results");
      out.writeVal(x.`total-results`)
    };
    {
      val v = x.items;
      if (v.isEmpty.`unary_!`) {
        out.writeNonEscapedAsciiKey("items");
        e3(v, out)
      } else
        ()
    };
    {
      out.writeNonEscapedAsciiKey("items-per-page");
      out.writeVal(x.`items-per-page`)
    };
    {
      out.writeNonEscapedAsciiKey("query");
      e37(x.query, out)
    };
    {
      val v = x.`next-cursor`;
      if (v.isEmpty.`unary_!`) {
        out.writeNonEscapedAsciiKey("next-cursor");
        out.writeVal(v.get)
      } else
        ()
    };
    out.writeObjectEnd()
  };
  private[this] def e0(x: io.crossref.ItemResponse, out: JsonWriter): Unit = {
    out.writeObjectStart();
    {
      out.writeNonEscapedAsciiKey("status");
      out.writeVal(x.status)
    };
    {
      out.writeNonEscapedAsciiKey("message-type");
      out.writeVal(x.`message-type`)
    };
    {
      out.writeNonEscapedAsciiKey("message-version");
      out.writeVal(x.`message-version`)
    };
    {
      out.writeNonEscapedAsciiKey("message");
      e1(x.message, out)
    };
    out.writeObjectEnd()
  }
};

I really have no idea how to debug this, so I'm just dumping what I know I have. Is there a better way to debug this? My case classes were derived from https://github.com/CrossRef/rest-api-doc/blob/master/api_format.md

hntd187 commented 6 years ago
Exception in thread "main" java.lang.ClassCastException: java.lang.Integer cannot be cast to scala.collection.Seq
    at io.crossref.Publication.<init>(JsonObjects.scala:123)
    at io.crossref.JsonImplicits$$anon$1.d4(JsonImplicits.scala:7)
    at io.crossref.JsonImplicits$$anon$1.d3(JsonImplicits.scala:7)
    at io.crossref.JsonImplicits$$anon$1.d1(JsonImplicits.scala:7)
    at io.crossref.JsonImplicits$$anon$1.d0(JsonImplicits.scala:7)
    at io.crossref.JsonImplicits$$anon$1.decodeValue(JsonImplicits.scala:7)
    at io.crossref.JsonImplicits$$anon$1.decodeValue(JsonImplicits.scala:7)
    at com.github.plokhotnyuk.jsoniter_scala.core.JsonReader.read(JsonReader.scala:529)
    at com.github.plokhotnyuk.jsoniter_scala.core.package$.readFromArray(package.scala:101)
    at io.crossref.Testing$.delayedEndpoint$io$crossref$Testing$1(CR.scala:67)
    at io.crossref.Testing$delayedInit$body.apply(CR.scala:51)
    at scala.Function0.apply$mcV$sp(Function0.scala:34)
    at scala.Function0.apply$mcV$sp$(Function0.scala:34)
    at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
    at scala.App.$anonfun$main$1$adapted(App.scala:76)
    at scala.collection.immutable.List.foreach(List.scala:389)
    at scala.App.main(App.scala:76)
    at scala.App.main$(App.scala:74)
    at io.crossref.Testing$.main(CR.scala:51)
    at io.crossref.Testing.main(CR.scala)

So the line it thinks are bad is my reference: Seq[Reference] = Seq.empty[Reference]

plokhotnyuk commented 6 years ago

Hi, Stephen!

Thanks for reporting!

I have reproduced that exception in the following test: https://github.com/plokhotnyuk/jsoniter-scala/commit/37b9f29a0db2d2cfe9f3e5de67aa1cd93fb5b42f#diff-7f1e691cb8eee9823fc1e4df91e30c44R9

Also, I see that the generated codec, that you have reported above doesn't throw that error, instead it throws another:

com.github.plokhotnyuk.jsoniter_scala.core.JsonParseException: unexpected field "journal-issue", offset: 0x00000b37, buf:
           +-------------------------------------------------+
           |  0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f |
+----------+-------------------------------------------------+------------------+
| 00000b10 | 6e 63 65 73 2d 63 6f 75 6e 74 22 3a 20 30 2c 0a | nces-count": 0,. |
| 00000b20 | 20 20 20 20 20 20 20 20 22 6a 6f 75 72 6e 61 6c |         "journal |
| 00000b30 | 2d 69 73 73 75 65 22 3a 20 7b 0a 20 20 20 20 20 | -issue": {.      |
| 00000b40 | 20 20 20 20 20 22 69 73 73 75 65 22 3a 20 22 31 |      "issue": "1 |
| 00000b50 | 2d 32 22 0a 20 20 20 20 20 20 20 20 7d 2c 0a 20 | -2".        },.  |
+----------+-------------------------------------------------+------------------+
    at com.github.plokhotnyuk.jsoniter_scala.core.JsonReader.decodeError(JsonReader.scala:646)
    at com.github.plokhotnyuk.jsoniter_scala.core.JsonReader.unexpectedKeyError(JsonReader.scala:75)
    at io.crossref.JsonCodecThings.d4(JsonImplicits.scala:2023)
    at io.crossref.JsonCodecThings.d3(JsonImplicits.scala:2102)
    at io.crossref.JsonCodecThings.d1(JsonImplicits.scala:2191)
    at io.crossref.JsonCodecThings.d0(JsonImplicits.scala:2287)
    at io.crossref.JsonCodecThings.decodeValue(JsonImplicits.scala:14)
    at io.crossref.JsonCodecThings.decodeValue(JsonImplicits.scala:12)
    at com.github.plokhotnyuk.jsoniter_scala.core.JsonReader.read(JsonReader.scala:544)
    at com.github.plokhotnyuk.jsoniter_scala.core.package$.readFromStream(package.scala:34)
    at io.crossref.CrossrefSpec.$anonfun$new$4(CrossrefSpec.scala:16)
    at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
    at org.scalatest.OutcomeOf.outcomeOf(OutcomeOf.scala:85)
    at org.scalatest.OutcomeOf.outcomeOf$(OutcomeOf.scala:83)
    at org.scalatest.OutcomeOf$.outcomeOf(OutcomeOf.scala:104)
    at org.scalatest.Transformer.apply(Transformer.scala:22)
...

And the same error for unexpected field I can get when turning off skipUnexpectedFields configuration option for the macro call:

  val codec: JsonValueCodec[ItemResponse] =
   JsonCodecMaker.make[ItemResponse](CodecMakerConfig(skipUnexpectedFields = false))
plokhotnyuk commented 6 years ago

I have reproduced that java.lang.ClassCastException in the isolated call of the constructor: https://github.com/plokhotnyuk/jsoniter-scala/commit/338d6cdba92662c187c1206e9f1c6809e21819bd

So it looks more like a bug of the scalac (I've opened an issue for that https://github.com/scala/bug/issues/10825 ), but I will investigate further.

plokhotnyuk commented 6 years ago

I've mitigated that compiler bug by renaming of reference-count field to referenceCount with using of the @named annotation: https://github.com/plokhotnyuk/jsoniter-scala/commit/e0fabd07db12934492153ca265a684a084d5b7ba

Now tests are failing due unexpected array JSON value, while a JSON object is expected as stated in the case class (relation: Option[Map[String, Relation]],):

com.github.plokhotnyuk.jsoniter_scala.core.JsonParseException: expected '{', offset: 0x0000788a, buf:
           +-------------------------------------------------+
           |  0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f |
+----------+-------------------------------------------------+------------------+
| 00007860 | 0a 20 20 20 20 20 20 20 20 22 72 65 6c 61 74 69 | .        "relati |
| 00007870 | 6f 6e 22 3a 20 7b 0a 20 20 20 20 20 20 20 20 20 | on": {.          |
| 00007880 | 20 22 63 69 74 65 73 22 3a 20 5b 5d 0a 20 20 20 |  "cites": [].    |
| 00007890 | 20 20 20 20 20 7d 2c 0a 20 20 20 20 20 20 20 20 |      },.         |
| 000078a0 | 22 49 53 53 4e 22 3a 20 5b 0a 20 20 20 20 20 20 | "ISSN": [.       |
+----------+-------------------------------------------------+------------------+
    at com.github.plokhotnyuk.jsoniter_scala.core.JsonReader.decodeError(JsonReader.scala:646)
    at com.github.plokhotnyuk.jsoniter_scala.core.JsonReader.com$github$plokhotnyuk$jsoniter_scala$core$JsonReader$$tokenError(JsonReader.scala:632)
    at com.github.plokhotnyuk.jsoniter_scala.core.JsonReader.readNullOrTokenError(JsonReader.scala:475)
    at io.crossref.JsonCodecThings.d44(JsonImplicits.scala:1628)
    at io.crossref.JsonCodecThings.d43(JsonImplicits.scala:1637)
    at io.crossref.JsonCodecThings.d42(JsonImplicits.scala:1651)
    at io.crossref.JsonCodecThings.d4(JsonImplicits.scala:2211)
    at io.crossref.JsonCodecThings.d3(JsonImplicits.scala:2256)
    at io.crossref.JsonCodecThings.d1(JsonImplicits.scala:2358)
    at io.crossref.JsonCodecThings.d0(JsonImplicits.scala:2461)
    at io.crossref.JsonCodecThings.decodeValue(JsonImplicits.scala:14)
plokhotnyuk commented 6 years ago

Changed the issue type to question (not a bug), because it is a Scala compiler error and can be easy mitigated by renaming of affected fields with using of the @named annotation or a field name mapping function for the configuration of the macro call.

plokhotnyuk commented 6 years ago

Another w/a for the scalac bug is to move a definition of the field with encoded chars (reference-count in our case) to be after the field that is affected by the exception (after reference field): https://github.com/plokhotnyuk/jsoniter-scala/commit/eb44f77ad2822f4557223ef733c1b02b97f5e75c#diff-622f98fd354a801ea63286f1c423810bR127

hntd187 commented 6 years ago

@plokhotnyuk thank you very much for the super fast turn around I appreciate it!

So I think Scala 2.12.6 is slated to come out very soon from the macro regression, so it would seem the compiler bug won't be fixed for sometime. I don't even know if it'll get into 2.12.7. So what do you want to do with this issue? Do you want me to leave it open as an FYI for maybe someone else coming along who has this problem or just close it? The work around solved what I was trying to do so at least there is a solution for the time being.

Other than that if you wanted some real world benchmarks of your library, I wrote some to see how the new JSON parser held up against my old parser, which was Json4s using Jackson.

[info] Benchmark                               Mode  Cnt      Score     Error  Units
[info] JsonBenchmarks.inter_read               avgt   20    533.260 ±  44.943  ms/op (x22 Faster)
[info] JsonBenchmarks.inter_write              avgt   20    400.184 ±   1.728  ms/op (x14 Faster)
[info] JsonBenchmarks.json4s_read              avgt   20  11897.006 ± 171.331  ms/op
[info] JsonBenchmarks.json4s_write             avgt   20   5694.458 ± 139.742  ms/op

This is JDK8 and Scala 2.12.4. Some background, I have 300mb-ish dumps of JSON I collect from Crossref, which comprise about 100k publications each. I'd say they cover a pretty broad sample of all kinds of different types and structures that a library would have to cover. I was just interested in the raw time taken to parse and write JSON to and from a case class. As you can see, I think the library does pretty well 🥇 You can find my (probably wrong or bad) benchmark code here if you are interested.

plokhotnyuk commented 6 years ago

Hi, Stephen!

Thanks for your feedback! Feel free to close the issue if you got an answer that satisfied your needs.

I'll add the Known issues section to the README with description of this case found by you including a link to the compiler bug.

Also, I'm going to add the FAQ section where I will gather Q & A about common and special cases, security and performance hints, etc.

I believe that jsoniter-scala will save lot of your time & money for JSON processing. It shines especially when you do not need to hold all JSON data in memory: 1) it can efficiently skip all not needed values, just do not add them to your case classes and turn on skipping of unknown fields in the CodecMakerConfig 2) it has a couple of methods to parse streamed JSON values or JSON array values: https://github.com/plokhotnyuk/jsoniter-scala/blob/17c0ccbed114ba3a35989fe1ff8ec553feda0c80/core/src/main/scala/com/github/plokhotnyuk/jsoniter_scala/core/package.scala#L37-L83 3) custom codecs can be written to provide the most efficient processing.

BTW, in your benchmarks jsoniter-scala do decoding/encoding of UTF-8 bytes, while other library works with UTF-16 encoded strings instead. Also, a manual call of the blackhole consume is not required if you return all results from the benchmark method (check generated sources in target/scala_x.x/src_managed).