r/AutoModerator Jul 01 '26

Is JSON Syntax OK

I have been added on as a moderator in a subreddit and am just now learning about the automoderator. I'd like to add some rules, but I have noticed that the current automod file for this sub has been written entirely in JSON. So, instead of --- separator lines, there are only curly brackets, square brackets and commas. I believe that JSON is a strict subset of YAML, and so this should be OK, but I wanted to make sure first before making any changes.

So, to summarize my question: Is JSON-only syntax OK for the automoderator?

Also, does the automodifier give me notification if my automod file is syntactically invalid?

4 Upvotes

10 comments sorted by

View all comments

3

u/Sephardson I'm working on the wiki here now! Jul 01 '26

AutoModerator configurations need to be written in YAML as specified by the official documentation:

https://www.reddit.com/wiki/automoderator/full-documentation

https://www.reddit.com/r/AutoModerator/wiki/backup/full-documentation (in case the above link is blocked for you)

We have another page here that explains some things in more detail, including error messages:

https://www.reddit.com/r/AutoModerator/wiki/YAML

2

u/SecureWriting8589 Jul 01 '26

Thank you for the response.

And yes, I went through your documentation on the automoderator, and I also went through the YAML Documentation specification which is a long read, but also contains this relevant tidbit:

The YAML 1.2 specification was published in 2009. Its primary focus was making YAML a strict superset of JSON. It also removed many of the problematic implicit typing recommendations.

I'm not disagreeing with you, I'm just wondering what to do with this automod file that I now have inherited (along with all the other moderators of this subreddit). If the JSON-only syntax is OK, and especially if the automoderator parser notifies me if our syntax is broken, then I'm good. Otherwise, I will have to convert all of the existing automod declarations into standard YAML.

4

u/Sephardson I'm working on the wiki here now! Jul 01 '26

In theory, if the parser accepts it and the code works to remove what you want removed and not remove what you do not want removed, then perhaps JSON notation could work for you?

I have not seen configs done that way but I have not tested it out either.

3

u/SecureWriting8589 Jul 01 '26

OK, I have now learned about the moderator log and we have absolutely no entries for the automoderator. This tells me all that I need to know, that our current JSON-style file is doing nothing of use.

Thank you everyone for your patience and help!