简体   繁体   English

由于循环 JSON 错误,Azure 持久功能无法返回 Object

[英]Azure Durable Functions cannot return an Object because of circular JSON error

Written in JavaScript I have an Activity function that I would like to initialize and return an Object to the Orchestrator function. Written in JavaScript I have an Activity function that I would like to initialize and return an Object to the Orchestrator function. The Object is initialized but cannot be return because of "Exception: TypeError: Converting circular structure to JSON". Object 已初始化但无法返回,因为“异常:TypeError:将循环结构转换为 JSON”。 Is there anyway to return an Object back to the有没有办法将 Object 退回给

Error message => Exception: TypeError: Converting circular structure to JSON错误消息 => Exception: TypeError: Converting circular structure to JSON

from your activity function you are returning something like this =>从您的活动 function 中,您返回的是这样的内容 =>

var a = {};
a.b = a;

When activity function returns object back to it Orchestrator, internally it makes a json and in the Orchestrator it parses the json.当活动 function 将 object 返回给 Orchestrator 时,它会在内部生成 json 并在 Orchestrator 中解析 Z4666DEEC76ECDF324D

JSON.stringify can not convert structures like this. JSON.stringify不能像这样转换结构。

Meaning activity functions can not return circular structure object.意思是活动函数不能返回循环结构 object。

You need to create a non circular object from the circular object and return it.您需要从circular object创建一个non circular object object 并将其返回。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM