platformOS Community

Bug? Byref memory issue?

Rich - One Orange Cow Mar 16 2021 at 11:15

I expect copyofhey to be it's own variable with it's memory space... but using the remove_hash_key filter it just removes from all everything ... I expect copyofhey not to be touched when:

{%- parse_json hey -%}
{"test": "hello", "test2": "goodbye"}
{%- endparse_json -%}

{%- assign copyofhey = hey -%}

{%- assign nothingofinterest = hey | remove_hash_key: "test2" -%}

{{copyofhey}}

{{hey}}

Yet the output is:

{"test":"hello"}

{"test":"hello"}

matt Mar 16 2021 at 11:21

Use this instead?

{%- parse_json copyofhey -%}{{hey}}{%- endparse_json -%}

  • Rich - One Orange Cow Mar 16 2021 at 11:25
    Nice one! I was literally about to post my workaround using capture but parse_json works much the same... still a little ugly and unexpected
Please sign in or fill up your profile to answer a question