Skip to content

Commit

Permalink
added missing escape
Browse files Browse the repository at this point in the history
  • Loading branch information
datomo committed Apr 8, 2024
1 parent 9b1ab57 commit e1c4e18
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,12 @@ public static PolyString ofNullable( String value ) {

@Override
public @Nullable String toJson() {
return value == null ? JsonToken.VALUE_NULL.asString() : value.replace( "\"", "\\\"" );
return value == null ? JsonToken.VALUE_NULL.asString() : value.replace( "\\", "\\\\" ).replace( "\"", "\\\"" );
}


public @Nullable String toQuotedJson() {
return value == null ? JsonToken.VALUE_NULL.asString() : "\"" + value.replace( "\"", "\\\"" ) + "\"";
return value == null ? JsonToken.VALUE_NULL.asString() : "\"" + value.replace( "\\", "\\\\" ).replace( "\"", "\\\"" ) + "\"";
}


Expand Down

0 comments on commit e1c4e18

Please sign in to comment.