Gson is an open-source Java library released by Google, primarily used for serializing Java objects to JSON strings or deserializing JSON strings into Java objects.
<dependencies>
<dependency>
<groupId>org.apache.dubbo.extensions</groupId>
<artifactId>dubbo-serialization-gson</artifactId>
<version>3.3.0</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.10.1</version>
</dependency>
</dependencies>
# application.yml (Spring Boot)
dubbo:
protocol:
serialization: gson
or
# dubbo.properties
dubbo.protocol.serialization=gson
# or
dubbo.consumer.serialization=gson
# or
dubbo.reference.com.demo.DemoService.serialization=gson
or
<dubbo:protocol serialization="gson" />
<!-- or -->
<dubbo:consumer serialization="gson" />
<!-- or -->
<dubbo:reference interface="xxx" serialization="gson" />