JSON processed by Dataview through Note Frontmatter Property possible?

Hello everyone,

About custom JSON in Obsidian

if I been informed correctly, the Obsidian Developers say, that they tolerate JSON as a value in Frontmatter Properties is but it’s not recommendend. But the App don’t support an access to custom JSONs to work with notes yet, which is a very big goal for me :). In the future it will be possible hopefully and they will create a Core Plugin for it.

What could be possible work for now

I’m imagin, if I write plenty of lines of JSON Code as a value in a Frontmatter Property of a Note, could the value as a JSON Data processed by dataviewjs to get a data result which would be display in a Note, where the dataviewjs Codeblock is in?

Frontmatter

---
json: {
  "foo": "bar",
  "tok": "qax"
}
---

Why I ask

I have a bunch of notes with have the same frontmatter structure (e.g. Link in Detail in a single Note). It would be easier that I could replace the structure of notes with only one JSON.

What I’m trying to do

I’m just thinking how JSON proccessing with Dataview Plugin could work without any other custom plugins.

Things I have tried

nothing yet

Best regards,
MB

I’m not sure I fully understand what you’re trying to do, but is it important to write your JSON data in the frontmatter of notes? And why exactly is it important that you can write it in JSON format?
It’s definitely possible to process JSON data with dataviewjs, but I’ve only done it the other way around (accessing JSON files to create dataview views to display within obsidian, not actually writing anything in JSON format within obsidian notes).
You could also use dataviewjs to access note frontmatter or lists in the note content and format them as JSON, then use them however you want.

If you write the following into your note in source mode:

---
json: 
  foo: "bar"
  tok: "qax"
---

It’ll show like this in reading mode (or live preview):

And you can access it from Dataview doing stuff like:

Foo: `= this.json.foo`

Which will show as:
image

Using the syntax you provided is illegal as yaml, so it’ll disable your entire frontmatter/properties section.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.