Fix properties in bulk when the property type changes

What I’m trying to do

After several hours of research trying to get the solution to this issue, I still don’t get it: is there a way to correct this error in batch for all the notes involved?

This happens when changing the type of the property, in this case from List to Text. That warning sign appears saying saying “Type mismatch, expected text”.
If I click on the warning sign, it fixes it.


When going to the YAML in source mode to see how it fixes it, I see that it’s something it has to be with the formatting:


After click on the warning sign (it fixs it):

I have a lot of notes to fix doing this process, so I was looking for ways to fix all of them in bulk. Since clicking in the warning sign can fix one of them, is there a way to do this process in bulk for all of them? (may be it exists natively in Obsidian and I’m not finding it)

Things I have tried

I’ve tried the plugin Linter to fix in bulk the formatting for all the values of that property. Is there this option: “Format YAML array sections” (here you can see the details in the plugin documentation), but it formats all the values instead just the one I want (“tabSelection” in this case). Is there a field in the plugin that says “Force key values to be single-line arrays” and I’m putting just the name of the property I want to change but it changes them all (so I’m not using it correctly I assume).

And it formats it like this with the value between brackets instead of fixing it the correct way like the one shown above

Is there a way to do this with this plugin, or natively with Obsidian, or other more easy and practical solution?

this should be handled by the types.json file in the config folder
try changing a property to a different type and see how the change reflects in the json file
the last change sticks as long as you don’t change it again

also, yes, there is a community plugin named ‘linter’ where in the settings you can set tags, etc. multiline (list)

list: more than one property key
text: one prop key

depends on what you want

Thanks for your reply.

I went to the types.json file, and the property type is already set as “text” (as intended, so there’s nothing to change there).

I will try to get clearer in case I didn’t express myself correctly:

After changing the property type from “List” to “Text”, the error with the warning sign appeared (it says “Type mismatch, expected text”). The intended result I’m looking for is to fix all the notes in bulk that now have this error with the warning sign, and to do that what I see is that Obsidian fixes it by changing the format (once I click in the warning sign, but I have to it one by one).

So my assumption is that to fix all the notes I have to format them all from

  - 🟧


tabSelection: 🟧

Is there a way to do this fix in bulk with Linter plugin, or natively with Obsidian, or other more easy and practical solution? (basically to format correctly all these notes, that Obsidian can already do but one by one by clicking the warning sign in each one of them)

as i said, depends on what you need
for example, i have aliases prop with one alias
with the format:

  - somealias

this is set like this by my template
i also set in linter the multi-line BUT even if there’s one item (key), multi-line is still okay so i’m not going to change it to single

so my advice is to keep it multi-line
but i don’t know what is tabSelection is doing for you

if you want to go to single
go to linter, set this property to single
lint folders or all files (full vault)
and close obsidian, check the types.json, set it to text
open obsidian

if there’s any quirks we’re not aware of, try again some other way to make the triangles go away

What I need for my use case is for the value to be formatted as text (i.e just one value, after the “:” of the property), and not as array (which is shown as a list, each value preceded by the “-”). This field (“tabSelection” in this case) will be always filled with just one value (not like in the example you shown, aliases could have multiple values as same as tags), and keeping as text is working better on my workflow.

That’s why it has to be a property “Text” type, and not “List” type.

By changing the property type from List to Text, all the notes created before are still formatted as lists (i.e with the “-” preceding the value). To be consistent with all the notes I’m trying to format them from this:

  - 🟧

To this:

tabSelection: 🟧

Sorry if I’m being repetitive with some explanations, I just want to be sure to be clear in what I’m expressing.

I’m looking at the Linter plugin menu and I’m not seeing the option to lint the notes and make the Properties I want as “single-line” formatted as text. I can see that those options are just for “alias” and “tags”.

Basically, I have to format all the notes being lists type to being text type (i.e the format that those notes are using in the YAML make the disticntion). If that option do exists in Linter, I still didn’t find it. Do you know how can it be done?

should be this one (never tried it yet):

you type in tabSelection and lint the vault (make a backup beforehand if you want)

i’m not sure the emoji can be a problem (i’m not making use of emojis since i started using the supercharged links plugin, which is prolly not use for you here)…?

good luck

Thanks. As I mentioned above about trying the process you say with Linter, the issue is this:

It formats the property, but as an array (i.e still a list), not as text (which is a different type. Text type properties are not an array, so are not formatted as such).

So the result I’m getting when I try Linter with this option is this:
and this still is an array

Instead of this:

I think it will be useful to make a distinction about this following thing because it can lead to a lot missunderstandings. It will be pretty useful for the people that may read this post, as it was to me once I iunderstand it:

Text type properties sintax is like this in the YAML:

Property: value

But Lists type properties sintax can be formatted in two ways:

As a single-line array:

list1: [value]

Or as a multi-line array:

- value 

List type properties are arrays, and arrays could be single-line, or multi-line.

What I want to accomplish is to change an array type property formatting to a
text property formatting in bulk for all the notes–and that just imply deleting the “-” and the line break. For example, for notes that have the property formatted as multi-line like this:

- Value 

I want to format them like this:

property: value 

Obsidian corrects the formatting like that once you:

  1. change the property type
  2. and then click in the “Warning” sign (as shown in the posts I’ve made above)
    But this correct the formatting just for this particular note.

I want to do to that in bulk for all the notes, so I still let the question open:
how can I change the formatting of the properties from a list type (array) format to text format in bulk?

my first reading of this thread was that you want to follow obsidian while obsidian (or something to do with emojis or a third party plugin) may be producing a bug which you think is standard behavior

my second feeling was that if you use dataview, you can still get at the property value if it’s a list

my third…,is that there must be a simple solution here but nobody is offering it…

there are two more plugins that can help you maybe:
multi properties and file cooker plugins

other than that, i’m out

Hi @Sprinter441,

I saw that you liked my script for merging properties. I assume that you found it in connection with this issue. I can inform you that the script can indeed fix this issue.

I ran it on some test files, using dataview to find the relevant files to fix, and templater to run the script.

Under your circumstances, the value will change from:

- value


property: value

Here’s how to use the script: Use the “update” treatment, and provide the same value as before. Change the dataview query to target the notes with the right property - value pair. See the comments in the code block.

// Properties to fix. The key is the property name, and the value should be the same as the existing value. Keep treatment as update 
const properties = [
	{key:'tabSelection', value: "🟧", treatment: "update"},

// Dataview API used to find the files to fix
const dv =["dataview"].api;

// Query used to find the notes with the target property and value pair
const query = `LIST
			   FROM ""
			   WHERE contains(tabSelection, "🟧")`;
// Run the query
const rawResults = await dv.tryQuery(query);

// Isolate the returned dataview values / notes
const notes = rawResults.values;

// Debugger, so the script stops the execution, and you can inspect the results, before continuing

// For each note, update the property in question
await Promise.all( => {
	const path = note.path;
	const found = tp.file.find_tfile(path);
	if (found) {
		await tp.user.merge_frontmatter_function2(found, properties);
	} else {
		new Notice("File note found!")

I highly recommend that you edit the query to limit the operation to a test selection of files. For example, change FROM "" to FROM #prop-test, where #prop-test is a tag you add to your test files.

1 Like

@Yurcee I’ve looked at those plugins, they seem useful but not for this particular use case since they don’t have the option to change one particular value for all the notes. Thanks for the recommendation tho, they could be useful in a future.

@Feralflora you nailed it man: I realized that your script could be a possible solution to this. The value property change as you shown it’s exactly the desired result I was looking for.
The thing is I don’t know how to run a script :sweat_smile:, I’m still a newcomer to Obsidian but excited about learning all these handy stuff. Should I put that code in an empty note–or may be in any note–and run it with the Templater option to replace the templates from the Command Palette?, or how can I use it?

The solution I’ve found was to open the Obsidian folders as text using an external (I used Notepad++). I didn’t know sh1t about regular expressions and these kind of external editors but I realized that could be useful to know it for the use case to do bulk changes in the vault :grin:.

Turns out that “regular expressions” are a way to search for common text string in the vault and be able to replace them, using these external text editors (it’s worth clarifying).

So after some research the way I’ve found to change all the values of one particular property was this one:

I open Notepad++ > File > Open Folder as Workspace > select Obsidian folder

Then you to find the values to change: Right click in Obsidian folder > Find in Files > Enable “Regular expression” in Search Mode

This is he formula for my particular use case
In “Find What” I put: \n -( 🟧| 🟨| 🟩| 🟥)
what this does is to search all the values that have have the format of a new line with a “-” and any of those color emojis. The pipe ir like an “or”, so it will search - :orange_square:, or - :yellow_square:, etc

In “Replace with” I put: \1
what this does is to change the value found before for just the emoji, so it will replace the new line, and the “-”, for just the emoji (what I wanted to do)

This is how it looked

I tested it before running it into the whole vault, and seemed to work spectacular. So I ran it, and it fixed all the notes as I was intending to do, and life is amazing.

Side note: I’m very proud of myself being able to understand and find solutions in a enviroment where a couple of months ago most stuff seemed like super nerdy and utterly complicated, and I’m very grateful to be part of these amazing community that had helped me in this process. This new world about building a PKM in Obsidian is amazing, and it is getting better the more I understand how it works.

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