# How to update a Dictionary-Variable?

**URL:** <https://klipper.discourse.group/t/how-to-update-a-dictionary-variable/7366>\
**Category:** General Discussion\
**Created:** [March 20, 2023, 4:38pm UTC](https://klipper.discourse.group/t/how-to-update-a-dictionary-variable/7366 "2023-03-20T16:38:15Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![theophile](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/theophile/32/31_2.png) [@theophile](https://klipper.discourse.group/u/theophile)\
**Post date:** [March 21, 2023, 10:00pm UTC](https://klipper.discourse.group/t/how-to-update-a-dictionary-variable/7366/6 "2023-03-21T22:00:28Z")

</div>

For that, I will refer you to this excellent post by @garethky:

> [@Macro Creation Tutorial](https://klipper.discourse.group/t/macro-creation-tutorial/30/20):
>
> something to add to the tutorial: The SET\_GCODE\_VARIABLE and SAVE\_VARIABLE commands in klipper require that you pass them Python literals. Simple strings and numbers are pretty easy but what about complex types like arrays or objects? This has been a stumbling block for more ambitious macros. If you have tried the tojson filter you have probably not had a lot of luck. Here is a way to do it using the pprint filter: [gcode\_macro TEST\_STUFF] variable\_hello: None gcode: {action\_respond\_info(p…

---

_[View the full topic](https://klipper.discourse.group/t/how-to-update-a-dictionary-variable/7366)._
