Skip to content

Commit 8172c28

Browse files
committed
[grid] Better json encoding of event data
1 parent cf49ba2 commit 8172c28

File tree

1 file changed

+6
-1
lines changed
  • java/server/src/org/openqa/selenium/events

1 file changed

+6
-1
lines changed

java/server/src/org/openqa/selenium/events/Event.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
import org.openqa.selenium.internal.Require;
2121
import org.openqa.selenium.json.Json;
22+
import org.openqa.selenium.json.JsonOutput;
2223

2324
import java.util.Objects;
2425
import java.util.StringJoiner;
@@ -39,7 +40,11 @@ public Event(UUID id, EventName eventName, Object data) {
3940
this.id = Require.nonNull("Message id", id);
4041
this.eventName = Require.nonNull("Event type", eventName);
4142

42-
this.data = JSON.toJson(data);
43+
StringBuilder builder = new StringBuilder();
44+
try (JsonOutput out = JSON.newOutput(builder)) {
45+
out.setPrettyPrint(false).writeClassName(false).write(data);
46+
}
47+
this.data = builder.toString();
4348
}
4449

4550
public UUID getId() {

0 commit comments

Comments
 (0)