diff --git a/CHANGELOG.md b/CHANGELOG.md
index a85ff9edcf..734907e210 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
 ## [Unreleased]
 
 ### Fixed
+* fix: `getString()` and `getObject()` no longer return `null` for non-null values of types enabled with `binaryTransferEnable` that have no `PGBinaryObject` implementation. `json`, `jsonb` and `xml`, whose binary format is their text, are now decoded. Other types, such as `inet`, now throw a `PSQLException` instead of returning a `PGobject` with a `null` value. Binary `xml` values no longer cause a `StackOverflowError` in `getString()`, `getObject()` and `getSQLXML()`
 * fix: `GSSInputStream.available()` now returns the number of decrypted bytes the stream holds and has not returned yet, instead of 0. Under GSS encryption, `PGConnection.getNotifications()` and non-blocking `COPY` reads no longer set a 1 ms socket timeout to probe for data while the stream still holds decrypted bytes [PR #4383](https://github.com/pgjdbc/pgjdbc/pull/4383)
 * fix: `PGStream.skip` no longer loops forever when the connection ends while the driver is discarding bytes, and no longer mistakes a stream that skips nothing for one that has ended. `InputStream.skip` may return zero with more data still coming, which a stream supplied through the `socketFactory` property is free to do; the driver now reads a byte in that case and treats only `-1` as the end [PR #4358](https://github.com/pgjdbc/pgjdbc/pull/4358)
 * fix: `LargeObjectManager` operations now work inside an active XA transaction. Since 42.7.13 an XA branch keeps the caller's `autoCommit=true`, and the guard rejected large objects as if the connection were idle. It now checks the server transaction state (`getTransactionState()`) instead of `autoCommit`, so a genuine auto-commit connection with no open transaction is still refused [Issue #4309](https://github.com/pgjdbc/pgjdbc/issues/4309) [PR #4310](https://github.com/pgjdbc/pgjdbc/pull/4310)
diff --git a/pgjdbc/src/main/java/org/postgresql/jdbc/PgConnection.java b/pgjdbc/src/main/java/org/postgresql/jdbc/PgConnection.java
index 553f99f0d0..65db7129eb 100644
--- a/pgjdbc/src/main/java/org/postgresql/jdbc/PgConnection.java
+++ b/pgjdbc/src/main/java/org/postgresql/jdbc/PgConnection.java
@@ -749,6 +749,27 @@ public LargeObjectManager getLargeObjectAPI() throws SQLException {
   // This holds a reference to the LargeObject API if already open
   private @Nullable LargeObjectManager largeobject;
 
+  /**
+   * Converts a value in binary format to text, for types without a {@link PGBinaryObject}
+   * implementation.
+   *
+   * @param type the type name
+   * @param byteValue the value in binary format
+   * @return the text representation of the value
+   * @throws SQLException if the binary format of the type can't be decoded
+   */
+  private String binaryToText(String type, byte[] byteValue) throws SQLException {
+    String text = TextualBinaryDecoding.decode(typeCache.getPGType(type), byteValue, getEncoding());
+
+    if (text == null) {
+      throw new PSQLException(
+          GT.tr("Cannot decode the binary format of type {0}. Remove the type from binaryTransferEnable, or register a PGBinaryObject implementation for it with addDataType.", type),
+          PSQLState.NOT_IMPLEMENTED);
+    }
+
+    return text;
+  }
+
   /**
    * This method is used internally to return an object based around org.postgresql's more unique
    * data types.
@@ -797,14 +818,14 @@ public Object getObject(String type, @Nullable String value, byte @Nullable [] b
           PGBinaryObject binObj = (PGBinaryObject) obj;
           binObj.setByteValue(byteValue, 0);
         } else {
-          obj.setValue(value);
+          obj.setValue(value == null && byteValue != null ? binaryToText(type, byteValue) : value);
         }
       } else {
         // If className is null, then the type is unknown.
         // so return a PGobject with the type set, and the value set
         obj = new PGobject();
         obj.setType(type);
-        obj.setValue(value);
+        obj.setValue(value == null && byteValue != null ? binaryToText(type, byteValue) : value);
       }
 
       return obj;
diff --git a/pgjdbc/src/main/java/org/postgresql/jdbc/PgResultSet.java b/pgjdbc/src/main/java/org/postgresql/jdbc/PgResultSet.java
index 1deb66f65a..cc940b793d 100644
--- a/pgjdbc/src/main/java/org/postgresql/jdbc/PgResultSet.java
+++ b/pgjdbc/src/main/java/org/postgresql/jdbc/PgResultSet.java
@@ -2436,6 +2436,13 @@ public boolean wasNull() throws SQLException {
           return ts.toString(ts.toLocalDateTimeBin(value));
         case Oid.TIMESTAMPTZ:
           return ts.toStringOffsetDateTime(value);
+        case Oid.JSON:
+        case Oid.JSONB:
+        case Oid.XML:
+          // Decode directly: for xml, internalGetObject() calls getSQLXML(), which calls
+          // getString()
+          return trimString(columnIndex, castNonNull(
+              TextualBinaryDecoding.decode(field.getOID(), value, connection.getEncoding())));
       }
       // internalGetObject requires thisRow to be non-null
       castNonNull(thisRow, "thisRow");
diff --git a/pgjdbc/src/main/java/org/postgresql/jdbc/TextualBinaryDecoding.java b/pgjdbc/src/main/java/org/postgresql/jdbc/TextualBinaryDecoding.java
new file mode 100644
index 0000000000..45ed59255d
--- /dev/null
+++ b/pgjdbc/src/main/java/org/postgresql/jdbc/TextualBinaryDecoding.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2026, PostgreSQL Global Development Group
+ * See the LICENSE file in the project root for more information.
+ */
+
+package org.postgresql.jdbc;
+
+import org.postgresql.core.Encoding;
+import org.postgresql.core.Oid;
+import org.postgresql.util.GT;
+import org.postgresql.util.PSQLException;
+import org.postgresql.util.PSQLState;
+
+import org.checkerframework.checker.nullness.qual.Nullable;
+
+import java.io.IOException;
+
+/**
+ * Decodes the binary representation of types whose binary format is their text representation in
+ * {@code client_encoding}, possibly prefixed by a format version.
+ */
+final class TextualBinaryDecoding {
+
+  /**
+   * The only binary format version of {@code jsonb} that PostgreSQL has defined so far.
+   */
+  private static final int JSONB_VERSION = 1;
+
+  private TextualBinaryDecoding() {
+  }
+
+  /**
+   * Decodes the binary representation of a {@code json}, {@code jsonb}, or {@code xml} value.
+   *
+   * @param oid the type OID
+   * @param bytes the value in binary format
+   * @param encoding the connection encoding
+   * @return the text representation of the value, or {@code null} if the type is not supported
+   * @throws PSQLException if the value can't be decoded
+   */
+  static @Nullable String decode(int oid, byte[] bytes, Encoding encoding) throws PSQLException {
+    int offset;
+
+    switch (oid) {
+      case Oid.JSON:
+      case Oid.XML:
+        offset = 0;
+        break;
+      case Oid.JSONB:
+        // jsonb_send() writes a version byte, followed by the text
+        if (bytes.length == 0 || bytes[0] != JSONB_VERSION) {
+          throw new PSQLException(
+              GT.tr("Unsupported binary format version {0} of type {1}",
+                  bytes.length == 0 ? "<none>" : bytes[0], "jsonb"),
+              PSQLState.DATA_ERROR);
+        }
+        offset = 1;
+        break;
+      default:
+        return null;
+    }
+
+    try {
+      return encoding.decode(bytes, offset, bytes.length - offset);
+    } catch (IOException ioe) {
+      throw new PSQLException(
+          GT.tr("Invalid character data was found.  This is most likely caused by stored data containing characters that are invalid for the character set the database was created in.  The most common example of this is storing 8bit data in a SQL_ASCII database."),
+          PSQLState.DATA_ERROR, ioe);
+    }
+  }
+}
diff --git a/pgjdbc/src/test/java/org/postgresql/jdbc/TextualBinaryDecodingTest.java b/pgjdbc/src/test/java/org/postgresql/jdbc/TextualBinaryDecodingTest.java
new file mode 100644
index 0000000000..20fe60e1d7
--- /dev/null
+++ b/pgjdbc/src/test/java/org/postgresql/jdbc/TextualBinaryDecodingTest.java
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2026, PostgreSQL Global Development Group
+ * See the LICENSE file in the project root for more information.
+ */
+
+package org.postgresql.jdbc;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import org.postgresql.core.Encoding;
+import org.postgresql.core.Oid;
+import org.postgresql.util.PSQLException;
+import org.postgresql.util.PSQLState;
+
+import org.junit.jupiter.api.Test;
+
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+
+class TextualBinaryDecodingTest {
+
+  private static final Encoding UTF8 = Encoding.getDatabaseEncoding("UTF8");
+
+  private static byte[] utf8(String s) {
+    return s.getBytes(StandardCharsets.UTF_8);
+  }
+
+  private static byte[] jsonb(int version, String s) {
+    byte[] text = utf8(s);
+    byte[] result = new byte[text.length + 1];
+    result[0] = (byte) version;
+    System.arraycopy(text, 0, result, 1, text.length);
+    return result;
+  }
+
+  @Test
+  void json() throws PSQLException {
+    assertEquals("{\"a\": \"Zürich 😀\"}",
+        TextualBinaryDecoding.decode(Oid.JSON, utf8("{\"a\": \"Zürich 😀\"}"), UTF8));
+  }
+
+  @Test
+  void jsonEmpty() throws PSQLException {
+    assertEquals("", TextualBinaryDecoding.decode(Oid.JSON, new byte[0], UTF8));
+  }
+
+  @Test
+  void xml() throws PSQLException {
+    assertEquals("<a>Zürich</a>", TextualBinaryDecoding.decode(Oid.XML, utf8("<a>Zürich</a>"), UTF8));
+  }
+
+  @Test
+  void jsonbSkipsVersionByte() throws PSQLException {
+    assertEquals("{\"a\": \"Zürich\"}",
+        TextualBinaryDecoding.decode(Oid.JSONB, jsonb(1, "{\"a\": \"Zürich\"}"), UTF8));
+  }
+
+  @Test
+  void jsonbWithoutVersionByte() {
+    PSQLException e = assertThrows(PSQLException.class,
+        () -> TextualBinaryDecoding.decode(Oid.JSONB, new byte[0], UTF8));
+    assertEquals(PSQLState.DATA_ERROR.getState(), e.getSQLState());
+    assertTrue(e.getMessage().contains("<none>"), e.getMessage());
+  }
+
+  @Test
+  void jsonbWithUnknownVersion() {
+    PSQLException e = assertThrows(PSQLException.class,
+        () -> TextualBinaryDecoding.decode(Oid.JSONB, jsonb(2, "{}"), UTF8));
+    assertEquals(PSQLState.DATA_ERROR.getState(), e.getSQLState());
+    assertTrue(e.getMessage().contains("jsonb"), e.getMessage());
+  }
+
+  @Test
+  void typeWithoutTextualBinaryFormat() throws PSQLException {
+    assertNull(TextualBinaryDecoding.decode(Oid.INET, new byte[]{2, 32, 0, 4, 127, 0, 0, 1}, UTF8));
+  }
+
+  @Test
+  void decodingFailure() {
+    Encoding failing = new Encoding(StandardCharsets.UTF_8) {
+      @Override
+      public String decode(byte[] encodedString, int offset, int length) throws IOException {
+        throw new IOException("invalid");
+      }
+    };
+
+    PSQLException e = assertThrows(PSQLException.class,
+        () -> TextualBinaryDecoding.decode(Oid.JSON, utf8("{}"), failing));
+    assertEquals(PSQLState.DATA_ERROR.getState(), e.getSQLState());
+    assertInstanceOf(IOException.class, e.getCause());
+  }
+}
diff --git a/pgjdbc/src/test/java/org/postgresql/test/jdbc2/BinaryTransferTextualTypesTest.java b/pgjdbc/src/test/java/org/postgresql/test/jdbc2/BinaryTransferTextualTypesTest.java
new file mode 100644
index 0000000000..94f1571ab4
--- /dev/null
+++ b/pgjdbc/src/test/java/org/postgresql/test/jdbc2/BinaryTransferTextualTypesTest.java
@@ -0,0 +1,174 @@
+/*
+ * Copyright (c) 2026, PostgreSQL Global Development Group
+ * See the LICENSE file in the project root for more information.
+ */
+
+package org.postgresql.test.jdbc2;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assumptions.assumeTrue;
+
+import org.postgresql.PGConnection;
+import org.postgresql.PGProperty;
+import org.postgresql.util.PGobject;
+import org.postgresql.util.PSQLException;
+
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedClass;
+import org.junit.jupiter.params.provider.MethodSource;
+
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.SQLXML;
+import java.sql.Statement;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Properties;
+
+/**
+ * Types enabled with {@code binaryTransferEnable} that have no
+ * {@link org.postgresql.util.PGBinaryObject} implementation must not be read as {@code null}.
+ */
+@ParameterizedClass(name = "binary = {0}")
+@MethodSource("data")
+public class BinaryTransferTextualTypesTest extends BaseTest4 {
+
+  public BinaryTransferTextualTypesTest(BinaryMode binaryMode) {
+    setBinaryMode(binaryMode);
+  }
+
+  public static Iterable<Object[]> data() {
+    Collection<Object[]> ids = new ArrayList<>();
+    for (BinaryMode binaryMode : BinaryMode.values()) {
+      ids.add(new Object[]{binaryMode});
+    }
+    return ids;
+  }
+
+  @Override
+  protected void updateProperties(Properties props) {
+    super.updateProperties(props);
+    if (binaryMode == BinaryMode.FORCE) {
+      PGProperty.BINARY_TRANSFER_ENABLE.set(props, "bool,json,jsonb,xml,inet");
+    }
+  }
+
+  @Test
+  public void json() throws SQLException {
+    String json = "{\"a\": [1, \"Zürich\", null]}";
+    assertTextValue("json", json, json);
+  }
+
+  @Test
+  public void jsonb() throws SQLException {
+    // jsonb normalises the text
+    assertTextValue("jsonb", "{\"a\":  [1, \"Zürich\", null]}", "{\"a\": [1, \"Zürich\", null]}");
+  }
+
+  @Test
+  public void xml() throws SQLException {
+    assumeTrue(isXmlEnabled(), "Server has been compiled --with-libxml");
+
+    try (PreparedStatement ps = con.prepareStatement("select cast(? as xml)")) {
+      ps.setString(1, "<a>Zürich</a>");
+      try (ResultSet rs = ps.executeQuery()) {
+        rs.next();
+        assertEquals("<a>Zürich</a>", rs.getString(1));
+        assertEquals("<a>Zürich</a>", rs.getSQLXML(1).getString());
+        assertEquals("<a>Zürich</a>", assertInstanceOf(SQLXML.class, rs.getObject(1)).getString());
+      }
+    }
+  }
+
+  @Test
+  public void typeWithoutBinaryDecoder() throws SQLException {
+    try (PreparedStatement ps = con.prepareStatement("select cast('127.0.0.1' as inet)");
+         ResultSet rs = ps.executeQuery()) {
+      rs.next();
+
+      if (binaryMode == BinaryMode.FORCE) {
+        assertThrows(PSQLException.class, () -> rs.getString(1));
+        assertThrows(PSQLException.class, () -> rs.getObject(1));
+        assertThrows(PSQLException.class, () -> rs.getObject(1, PGobject.class));
+      } else {
+        assertEquals("127.0.0.1", rs.getString(1));
+        assertEquals("127.0.0.1", assertInstanceOf(PGobject.class, rs.getObject(1)).getValue());
+      }
+    }
+  }
+
+  /**
+   * A registered {@link PGobject} subclass without {@link org.postgresql.util.PGBinaryObject}
+   * gets the decoded text, too.
+   */
+  @Test
+  public void registeredDataType() throws SQLException {
+    con.unwrap(PGConnection.class).addDataType("jsonb", JsonbObject.class);
+
+    try (PreparedStatement ps = con.prepareStatement("select cast('{\"a\":  1}' as jsonb)");
+         ResultSet rs = ps.executeQuery()) {
+      rs.next();
+
+      JsonbObject object = assertInstanceOf(JsonbObject.class, rs.getObject(1));
+      assertEquals("jsonb", object.getType());
+      assertEquals("{\"a\": 1}", object.getValue());
+      assertEquals("{\"a\": 1}", rs.getObject(1, JsonbObject.class).getValue());
+      assertEquals("{\"a\": 1}", rs.getString(1));
+    }
+  }
+
+  @Test
+  public void registeredDataTypeWithoutBinaryDecoder() throws SQLException {
+    con.unwrap(PGConnection.class).addDataType("inet", InetObject.class);
+
+    try (PreparedStatement ps = con.prepareStatement("select cast('127.0.0.1' as inet)");
+         ResultSet rs = ps.executeQuery()) {
+      rs.next();
+
+      if (binaryMode == BinaryMode.FORCE) {
+        PSQLException e = assertThrows(PSQLException.class, () -> rs.getObject(1));
+        assertTrue(e.getMessage().contains("inet"), e.getMessage());
+        assertThrows(PSQLException.class, () -> rs.getObject(1, InetObject.class));
+      } else {
+        assertEquals("127.0.0.1", assertInstanceOf(InetObject.class, rs.getObject(1)).getValue());
+      }
+    }
+  }
+
+  public static class JsonbObject extends PGobject {
+  }
+
+  public static class InetObject extends PGobject {
+  }
+
+  private void assertTextValue(String type, String input, String expected) throws SQLException {
+    try (PreparedStatement ps = con.prepareStatement("select cast(? as " + type + ")")) {
+      ps.setString(1, input);
+      try (ResultSet rs = ps.executeQuery()) {
+        rs.next();
+        assertEquals(expected, rs.getString(1), "getString()");
+        assertFalse(rs.wasNull(), "wasNull()");
+
+        PGobject object = assertInstanceOf(PGobject.class, rs.getObject(1), "getObject()");
+        assertEquals(type, object.getType(), "getObject().getType()");
+        assertEquals(expected, object.getValue(), "getObject().getValue()");
+        assertEquals(expected, rs.getObject(1, PGobject.class).getValue(),
+            "getObject(PGobject.class)");
+      }
+    }
+  }
+
+  private boolean isXmlEnabled() {
+    try (Statement stmt = con.createStatement()) {
+      stmt.executeQuery("select cast('<a>b</a>' as xml)").close();
+      return true;
+    } catch (SQLException e) {
+      return false;
+    }
+  }
+}
