How to get json object in botpress custom component?

孤街浪徒 提交于 2019-12-05 18:53:15

Try below 2 changes and it should work

{
    type: 'custom',
    module: 'custom-component',
    component: 'InfaLinkPreview',
    text: data.text,
    response: {
        data
    }
}

and

contentArray = JSON.parse(this.props.response.data.session.response)

I'm gonna use variable text to represent your JSON data. Seems like there is a call of text.toString() somewhere in the flow which translates it into [object Object] and when you call JSON.stringify(text) you get just that. I suggest you look at the whole program flow and check if there is an unecessary toString() call somewhere on your JSON object.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!