Skip to content

Commit

Permalink
remove \\u0000 from json string (fix #475)
Browse files Browse the repository at this point in the history
  • Loading branch information
tminglei committed Mar 17, 2020
1 parent 678f8ac commit 60dd94c
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ trait PgCirceJsonSupport extends json.PgJsonExtensions with utils.PgCommonJdbcTy
new GenericJdbcType[Json](
pgjson,
(v) => parse(v).getOrElse(Json.Null),
(v) => v.asJson.spaces2,
(v) => v.asJson.spaces2
.replace("""\\u0000""", "")
.replace("\\u0000", ""),
hasLiteralForm = false
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ trait PgJawnJsonSupport extends json.PgJsonExtensions with utils.PgCommonJdbcTyp
new GenericJdbcType[JValue](
pgjson,
(v) => JParser.parseUnsafe(v),
(v) => v.render,
(v) => v.render
.replace("""\\u0000""", "")
.replace("\\u0000", ""),
hasLiteralForm = false
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ trait PgPlayJsonSupport extends json.PgJsonExtensions with utils.PgCommonJdbcTyp
new GenericJdbcType[JsValue](
pgjson,
(v) => Json.parse(v),
(v) => Json.stringify(v).replace("\\u0000", ""),
(v) => Json.stringify(v)
.replace("""\\u0000""", "")
.replace("\\u0000", ""),
hasLiteralForm = false
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ trait PgSprayJsonSupport extends json.PgJsonExtensions with utils.PgCommonJdbcTy
new GenericJdbcType[JsValue](
pgjson,
(s) => s.parseJson,
(v) => v.toJson.compactPrint,
(v) => v.toJson.compactPrint
.replace("""\\u0000""", "")
.replace("\\u0000", ""),
hasLiteralForm = false
)

Expand Down

0 comments on commit 60dd94c

Please sign in to comment.