Watson Workspace will no longer be available after February 28, 2019. Learn more.

Developers

Annotations include backslash "\" when querying Get Message Graphql.

Comments

3 comments

  • Avatar
    Scott Chapman

    The annotations as basically an array of strings there, so within that strings the quotes get escaped. You can go through the annotation array and parse the strings into JSON and use them as objects.

  • Avatar
    Miguel Estrada

    Hello,

    The annotations are currently structured JSON which is stored as a string inside the data model.  We will consider in the future the ability for the data model to be dynamically extended at runtime in a way that allows direct reporting vial GraphQL of the elements inside items such as annotations.

    In the meantime, though visually unappealing, the code for handling the contents of annotations is no different than any other code.  For example, see the lines that follow this code:

    https://github.com/watsonwork/watsonwork-sentiment/blob/master/app.js#L98

  • Avatar
    TADAHIRO HARA

    @Scott Chapman
    @Miguel Estrada
    Thank you for your quick answering and explaining detail.

    I understand that it's easy to parse in JavaScript
    Actually, I am coding by using Java and Gson. It needs a few steps to parse JSON which is stored as a string inside.(e.g. substring, replace)
    Anyway, it is not a problem.

    Thank you.

Please sign in to leave a comment.