# Tag/View json format - Could arrays be replaced with dictionaries for better efficiency and speed?

**URL:** <https://forum.inductiveautomation.com/t/tag-view-json-format-could-arrays-be-replaced-with-dictionaries-for-better-efficiency-and-speed/56145>\
**Category:** Ignition\
**Tags:** ignition81\
**Created:** [February 15, 2022, 2:05am UTC](https://forum.inductiveautomation.com/t/tag-view-json-format-could-arrays-be-replaced-with-dictionaries-for-better-efficiency-and-speed/56145 "2022-02-15T02:05:14Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![justin.brzozoski](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justin.brzozoski/32/13452_2.png) [@justin.brzozoski](https://forum.inductiveautomation.com/u/justin.brzozoski)\
**Post date:** [February 15, 2022, 7:39pm UTC](https://forum.inductiveautomation.com/t/tag-view-json-format-could-arrays-be-replaced-with-dictionaries-for-better-efficiency-and-speed/56145/2 "2022-02-15T19:39:56Z")

</div>

I agree with what you're trying to do, but it gets sticky when some parts of Ignition/Perspective expect the view to be "proper" JSON, which enforces more restrictions on keys than Python dicts do...

Among other things, they must start with a letter (no numbers or other symbols) and are not _supposed_ to have spaces in them. Some bits of Ignition will start complaining if you break these rules.

> [@\[bug?\] Invalid key on object binding](https://forum.inductiveautomation.com/t/bug-invalid-key-on-object-binding/45763):
>
> Hello folks, This is not a game-breaking issue, since everything works correctly (so far), but I really don’t like that little red triangle popping up above my properties. I’d also like to make sure I didn’t do something wrong… So here goes: This is created by a python script, it’s a dict that has integers as keys. The version is 8.1.3 [image] If I change the key to not be an integer anymore, the problem disappears: [image] Note that if I only cast to a string, without adding something, …

Again, I really like your idea and wish IA could make it happen, because I **hate** traversing tag config trees and/or view trees in their JSON format right now. Having to walk and check each member of a list looking for a matching name is annoying. I'm just pointing out the reason I'm aware of that would explain why they did it the way they did.

And while it's far less pretty than your "new" style, this is currently possible:

```auto
def lookup(array, name, key='name'):
    return next(iter(x for x in array if x[key] == name))

tagType = lookup(lookup(lookup(sample['tags'],'Area 2')['tags'],'Sub Area 2')['tags'],'Tag 1')['tagType']

```

---

_[View the full topic](https://forum.inductiveautomation.com/t/tag-view-json-format-could-arrays-be-replaced-with-dictionaries-for-better-efficiency-and-speed/56145)._
