Skip to content
This repository was archived by the owner on Dec 15, 2021. It is now read-only.
This repository was archived by the owner on Dec 15, 2021. It is now read-only.

ResponseChatBubble (de)serialization issue #32

Description

@arsenalol1

Hi !

I encoutred a problem with serialization of the attribute ResponseChatBubble.textToSpeech.
Api.ai want this :
{ "type": "simple_response", "platform": "google", "textToSpeech": "This is a simple response." }

But the class ResponseChatBubble generate this JSON :
{ "items": [ { "textToSpeech": "This is a simple response." } ], "type": "simple_response", "platform": "google" }

Even the deserialization is not working because the ResponseChatBubble is not expecting an array but a string value.

For testing :

  • Deserialization

ResponseChatBubble response = (ResponseChatBubble) GsonFactory.getDefaultFactory().getGson().fromJson( "{ \"speech\": \"Hey!\",\"messages\": [{ \"type\": \"simple_response\", \"platform\": \"google\", \"textToSpeech\": \"This is a simple response.\" }]}", Fulfillment.class).getMessages().get(0);

Here the object response does not contain the message "This is a simple response.".

  • Serialization :

Item item = new Item(); item.setTextToSpeech("This is a simple response."); response.setItems(Lists.newArrayList(item)); String json = GsonFactory.getDefaultFactory().getGson().toJson(response);
The json value will be contain an array like a said before.

Thanks !

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions