回答此问题可获得 20 贡献值,回答如果被采纳可获得 50 分。
<p>我有这个JSON对象,我想更新对象中的值。我找到了一种方法来处理stackoverflow(<a href="https://stackoverflow.com/questions/35262216/json-handling-in-robot">Json handling in ROBOT</a>)和它的失败,我不明白为什么。在</p>
<p>这是目标:</p>
<pre><code>{"elementKey":"P690-C0-C3-B1","fields":[{"key":"P690-C1-C2-C1-C1-C1-F0","values":[]},{"key":"P690-C0-C2-F8","values":["1200"]},{"key":"P690-C0-C2-F9","values":["22000"]},{"key":"P690-C0-C2-F11","values":["I"]},{"key":"P690-C0-C2-F10","values":["2200"]},{"key":"P690-C0-C2-C0-C0-F0","values":["98-zsg-2"]},{"key":"P690-C1-C0-C0-F1","values":["Personenauto"]},{"key":"P690-C1-C0-C0-F2","values":["Personenauto KVP"]},{"key":"P690-C0-C2-F6","values":["B"]},{"key":"P690-C0-C2-F7","values":["75"]},{"key":"P690-C0-C2-F4","values":["2"]},{"key":"P690-C0-C2-F5","values":["5"]},{"key":"P690-C0-C2-F2","values":["model"]},{"key":"P690-C0-C2-F3","values":["2017"]},{"key":"P690-C1-C2-C2-C2-C1-F0","values":[]},{"key":"P690-C0-C2-F1","values":["merk"]}]}
</code></pre>
<p>在机器人框架中,我做了这个测试,灵感来自于给定的链接。在</p>
^{pr2}$
<p>使用${new_value}我尝试了value=shizzelliz,value[0]=shizzleliz,value[1]=shizzleliz,P690-C1-C2-C1-C1-C1-F0=shizzlliz</p>
<p>全部给出错误:<code>AttributeError: 'list' object has no attribute 'update'</code></p>
<p>当我将${json[“fields”]}更改为${json}时,give值被设置为库,而不是de fields部分/集合中。在</p>
<p>有人知道我做错了什么吗?如果您对我如何更新值有什么建议,我非常希望:)</p>
<p>目标是更改:<code>{"key":"P690-C1-C2-C1-C1-C1-F0","values":[]}</code>
收件人:<code>{"key":"P690-C1-C2-C1-C1-C1-F0","values":["shizzleliz"]}</code></p>