Custom formats for the JSON validator

Starting with JSONBuddy 4.6, you can add custom formats for the JSON validator as regular expressions using a simple configuration file. The JSON editor has two commands to give you easy access to this functionality:

Commands for JSON custom formats

Commands for JSON custom formats.

How to add and use custom formats?

Use the Open JSON validator custom formats command to open the JSON configuration file for custom formats directly in JSONBuddy. This is a standard JSON document and the default one will be loaded in the editor. You can then add your own entries to the JSON array for your validation tasks. You can also replace some existing formats already provided by the JSON validator of JSONBuddy. A user-defined format overrides the built-in definition.

The standard configuration has the following entry:

[
  {
    "format": "my-custom-format",
    "regex": "^[a-z, A-Z, /]+$"
  }
]

As you can see, all you need to do is provide two simple strings: the identifier of the new format and a valid regular expression. After you finish adding entries, save the configuration file and activate the new formats with the Reload JSON validator custom formats command. All open JSON documents are immediately validated using the new format definitions.

You can also see the names of your own formats while editing JSON data in the editor:

library example with custom format definition

library example with custom format definition.

The library example, which is part of the standard installation, also uses a custom format. Check it out and try different regular expressions.

Take a detailed look at some other features of JSONBuddy

JSONBuddy is more than just a JSON editor for Windows ®. Learn more on clicking the images and links below.