rsocket-js icon indicating copy to clipboard operation
rsocket-js copied to clipboard

JsonSerializer encode/decode issue

Open hantsy opened this issue 5 years ago • 0 comments

When decoding a json to object, it added escape to string based value.

Expected Behavior

{"id":"5f0bcaa46e0ba209eb68f47b","body":"test","sentAt":"2020-07-13T02:44:52.628Z"}

Actual Behavior

{"id":"5f0bcaa46e0ba209eb68f47b","body":"\"test\"","sentAt":"2020-07-13T02:44:52.628Z"}

Steps to Reproduce

I have written a sample which is help for reproducing this issue.

  • Client is Angular 10/NodeJS 14
  • Backend is Java 14/Spring Boot 2.4.0.M1, Kotlin, using RSocket WebSocket transport protocol.

https://github.com/hantsy/angular-spring-rsocket-sample

Update: when I perform a query on the Mongo server, it shows.

> db.messages.find();
{ "_id" : ObjectId("5f1564db0a7da37b085e8bd7"), "body" : "test", "sentAt" : ISODate("2020-07-20T09:33:15.527Z"), "_class" : "com.example.demo.Message" }
{ "_id" : ObjectId("5f15650a0a7da37b085e8bd8"), "body" : "\"hello rsocket\"", "sentAt" : ISODate("2020-07-20T09:34:02.042Z"), "_class" : "com.example.demo.Message" }
{ "_id" : ObjectId("5f1565140a7da37b085e8bd9"), "body" : "\"yeah, finally works\"", "sentAt" : ISODate("2020-07-20T09:34:12.453Z"), "_class" : "com.example.demo.Message" }

Does this mean when the server received the message from the client, the JSON serializer added a slash to escape the string?

hantsy avatar Jul 13 '20 02:07 hantsy