The trick I thought of was to explicitly exclude many of the Obsidian-default keys associated with a file: lots of them are arrays or large nested objects. I think my vault might have an infinite loop of pages via inlinks. Thus, the first step inside the dataviewjs block:
const excludes = ["file", "aliases", "tags", "position", "links", "inlinks", "outlinks", "etags", "frontmatter", "lists", "tasks"];
Next was just a whole bunch of ugly trial and error, which maybe someone knows how to express more elegantly than this mess of code. But it does work. To continue the same dataviewjs block:
let myFields = new Set();
.forEach(([thing1, thing2]) =>
.forEach(k => excludes.contains(k) ? 0 : myFields.add(k))
let myFieldsDV = dv.array(Array.from(myFields));
I do not know exactly what “thing1” and “thing2” represent conceptually; “k” is keys.
So, this will get you a list of inline keys from your vault that are mostly ones you have created. (I’m sure I missed filtering out some Obsidian-default ones!)
Where I got stuck: I could not figure out how to associate a file.path or even a count of notes with each key. If you see anything suspicious in the list, you’d have to do an additional search using a
.where(<suspicious key>) or something like that. Something I noticed in my vault: many of my inline Dataview fields show up twice because they are not in the standard Dataview format in my notes (e.g. my list includes both “Bed Time” and “bed-time”, even though only “Bed Time” exists explicitly in my notes).