Properties: Support multi-level YAML (nested attributes)

Use case or problem

We need to be able to support multi-level YAML. Especially for Dataview users

---
parent:
  - child1:
    - grandchild1: 1
    - grandchild2: 2
  - child2:
    - grandchild3: 3
    - grandchild4: 4
---
183 Likes

+1 most of my yaml is nested, for example:

book:
  started: <% tp.file.creation_date("YYYY-MM-DD") %>
  finished: 
  format: Digital
  status: Reading
  title: [""]
  authors: [""]
  tags: [""]
  ISBN: 
7 Likes

+1 here, too

I use nested properties similar to above, to group a selection of related properties;

category:
  area: work
  company: company1
  client: client1
  project: project1
6 Likes

+1 from me too. I use nested YAML across the vault.

4 Likes

Current view shows my category property as ‘unknown’;

No type selected;
CleanShot 20230728 165422 tuRT4yEV

3 Likes

Same, I use nested YAML for several things, they work with Dataview, and switching to source view to edit them is not ideal.

6 Likes

+1 I use nested properties loads in my notes - particularly the TTRPG related ones.
The usability with Dataview is notable, but there are also plugins like Fantasy Calendar that relies on nested YAML.

5 Likes

I have reported this as a bug. Two weeks ago, nested attributes were fully supported. Now they are broken. Cannot edit nested properties in Preview mode

6 Likes

Would be good if the below worked as well:

urls:
  youtube:
    first: https://....
    second: https://....
  website: https://....

Unfortunately, after reporting this as a bug, I inadvertently accepted an answer for it and it then got put in the “resolved bugs” graveyard. Derp derp!

So, if others would like this followed up on, perhaps you can bring it up in the bug reports; I don’t want to wear out my welcome on this topic. :slight_smile:
Cheers.

I did not understand what you mean by “work using maps.” Can you explain? Thanks.

Adding my voice to this feature request, I too use nesting to structure my frontmatter

4 Likes

Objects, i.e., key-value pairs, in addition to just lists.

1 Like

+1 for me too

Adding my voice as well – while I can manually format a property as an object in source view, my dataview tables and filtered graph views really shine with nested property values.

+1 from me for support for nested properties

+1 for me too… most of my front matter are nested.
i asked on Discord abt this & they directed me here

Suggestion –

How about “flattening” nested properties by using a dot ‘.’ as separator? This would make the naming consistent with what one would see if they had previously used Dataview to display nested fields without a column name alias.

For example, with the following YAML:

book:
  finished: 2023-09-01 
  format: Digital
  status: Reading

The new Properties editor could display it as:

book.started: 2023-09-01
book.format: Digital
book.status: Reading

I think this would be an improvement over the current approach, which displays it in JSON format:

book: {"started": "2023-09-01", "format": "Digital", "status": "Reading"}
18 Likes

+1 from me on this. I organize a lot of my notes with nested links off to external resources that they relate to.

1 Like

I tried this approach by manually introducing the dot notation in my YAML. But it didn’t play well with Dataview for some reason, not even allowing the fully nested key.

The best approach would be an expandable nested list but until then editing in source is the only way there is.