From 95dea826c1d671eadf925eb24ab641542b2cdf2c Mon Sep 17 00:00:00 2001 From: Jamie B <53781962+JamieB-gu@users.noreply.github.com> Date: Fri, 13 Dec 2024 18:50:36 +0000 Subject: [PATCH] Use Circe's `deepDropNullValues` instead of `withoutNull` (#27673) `DotcomRenderingUtils.withoutNull` is not recursive, therefore nested `null` fields make it through to DCAR, causing validation errors. --- .../pageElements/EditionsCrosswordRenderingDataModel.scala | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/common/app/model/dotcomrendering/pageElements/EditionsCrosswordRenderingDataModel.scala b/common/app/model/dotcomrendering/pageElements/EditionsCrosswordRenderingDataModel.scala index 3b6c92c1d83..189b9d0ee83 100644 --- a/common/app/model/dotcomrendering/pageElements/EditionsCrosswordRenderingDataModel.scala +++ b/common/app/model/dotcomrendering/pageElements/EditionsCrosswordRenderingDataModel.scala @@ -27,9 +27,7 @@ object EditionsCrosswordRenderingDataModel { })) def toJson(model: EditionsCrosswordRenderingDataModel): JsValue = - DotcomRenderingUtils.withoutNull( - Json.obj( - "crosswords" -> Json.parse(model.crosswords.asJson.toString()), - ), + Json.obj( + "crosswords" -> Json.parse(model.crosswords.asJson.deepDropNullValues.toString()), ) }