diff --git a/.gitignore b/.gitignore
index 78a19f71f3a6d..0415d80bc86c1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -135,3 +135,4 @@ bazel-testlogs
javascript/node/selenium-webdriver/.vscode/settings.json
dotnet-bin
+.metadata/
diff --git a/java/src/org/openqa/selenium/remote/RemoteWebDriver.java b/java/src/org/openqa/selenium/remote/RemoteWebDriver.java
index 628d66088f916..9e518401b8dab 100644
--- a/java/src/org/openqa/selenium/remote/RemoteWebDriver.java
+++ b/java/src/org/openqa/selenium/remote/RemoteWebDriver.java
@@ -89,7 +89,6 @@
import org.openqa.selenium.remote.http.ClientConfig;
import org.openqa.selenium.remote.http.ConnectionFailedException;
import org.openqa.selenium.remote.http.HttpClient;
-import org.openqa.selenium.remote.internal.WebElementToJsonConverter;
import org.openqa.selenium.remote.tracing.TracedHttpClient;
import org.openqa.selenium.remote.tracing.Tracer;
import org.openqa.selenium.remote.tracing.opentelemetry.OpenTelemetryTracer;
diff --git a/java/src/org/openqa/selenium/remote/WebElementToJsonConverter.java b/java/src/org/openqa/selenium/remote/WebElementToJsonConverter.java
new file mode 100644
index 0000000000000..edb4c9a28d9cb
--- /dev/null
+++ b/java/src/org/openqa/selenium/remote/WebElementToJsonConverter.java
@@ -0,0 +1,93 @@
+// Licensed to the Software Freedom Conservancy (SFC) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The SFC licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.openqa.selenium.remote;
+
+import static java.util.stream.Collectors.toList;
+
+import java.lang.reflect.Array;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.function.Function;
+import org.openqa.selenium.WrapsElement;
+
+/**
+ * Converts {@link RemoteWebElement} objects, which may be {@link WrapsElement wrapped}, into their
+ * JSON representation as defined by the WebDriver wire protocol. This class will recursively
+ * convert Lists and Maps to catch nested references.
+ *
+ * @see
+ * WebDriver JSON Wire Protocol
+ */
+public class WebElementToJsonConverter implements Function