#781 List formatting in Trio files

Steve Eynon Thu 23 Jan

The Trio documentation describes rules for nesting Dicts and Grids, both in an easy-to-read, multi-line, human readable format.

I was wondering if a similar, multi-line, format exists for Lists?

In JSON, a List of Objects may be expressed like this:

{
    "name" : "Outer Object",
    "list" : [
        {
            "name" : "item 1",
            "val0" : 1,
            "val1" : 2,
        },
        {
            "name" : "item 2",
            "val2" : 3,
            "val3" : 4,
        },
        {
            ...
        }
    ]
}

Substituting Objects for Dicts, how would I represent similar in a Trio file?

If not possible today, would Project Haystack consider adding an easy-to-read, multi-line format for Lists?

Or is the answer simply, "Project Haystack is not for this kind of data."?

Brian Frank Thu 23 Jan

I brainstormed with Jason about it this week because we need to switch the children protos in defs to be more formally defined as a list of dicts. What we came up with just normal Zinc/JSON format with following rule:

  1. Opening line starts with "[" or "{"
  2. Rest of the list/dict is indented two lines like multi-line strings

That is still easy to parse, easy to write, and easy to read:

def: ^someExample
children: [
  {this, is, one, dict},
  {here, is, another},
  ]

Login or Signup to reply.