I am not sure if you described the problem completely, as “tag” has something to do with flows and cards.
Anyway, search the forum and find for example Can running a script from a card create a tag?
It gives some clues.
That tag is a tag that will be like any other device capability value tag.
If you want it returned as a string tag (advanced code flow card) then you’ll first have to first parse the JSON object to a string, and then return that string (instead of your “true”).
If you do want it as a tag like any other device capability value, you’ll also have to parse the JSON to a string first.
Tokens/tags just don’t accept a json object as value, either string, number or boolean.