https://retellai.com/?utm_source=discord&utm_medium=seo logo
: Best practice to persist and update a selected ...
# ❓・ai-evy-support
d
@AI Evy : Best practice to persist and update a selected object across turns when Extract Dynamic Variable only supports text/enum/bool (no object)? My API returns devices[], I pick one (currentDevice = devices[i]); callers may update one field per turn (reportingInterval, firmwareVersion, nextMaintenanceDate). Should I store currentDevice as JSON text and use .walk to read fields—and if so, how do I update a single field (can I mutate nested fields or must I rewrite the JSON), and can tool/form params use dot paths like currentDevice.reportingInterval/currentDevice.id instead of separate variables per field?
a
Thanks for tagging me @dazzling_kiwi_86761. I'll look through relevant sources and get back to you shortly.
​ To learn more, see the sources I considered: [[1] Extract Dynamic Variables](https://docs.retellai.com/build/single-multi-prompt/extract-dv) [[2] Integrate any system with custom function](https://docs.retellai.com/build/single-multi-prompt/custom-function) [[3] dynamic variables in function query parameters are not parsed](https://discord.com/channels/1186424376300679209/1414306451656151291) ​
### Answer Extract Dynamic Variable in Retell AI only supports text, number, enum, or boolean types—not objects—so you cannot natively persist a full object structure that allows field-level mutation [(1) ]() . If your API returns devices[], you can store your selected device as a JSON string (text variable) , but there is no built-in support to directly mutate nested fields; you would need to rewrite and replace the entire JSON text when updating a field . For handling updates, you would extract the JSON, modify the desired field in your backend or in a custom function, then overwrite the dynamic variable with the new JSON text [(2) ]() . There is no documented support for mutating nested fields of a text variable in-place. Regarding tool/form parameters: passing dot-paths like currentDevice.reportingInterval is not supported for parsing dynamic variables in function query parameters [(3) ]() . You must use separate variables per field, or parse the JSON yourself in your backend after receiving the full text value .
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.