Are you ready to experience a truly optimized workflow with Meta Box Local JSON? The local JSON feature for the field group has been officially released from MB Builder 4.10. By loading field configurations from JSON files as a priority instead of the database, this game-changing feature makes field management and synchronization faster, easier, and more efficient than ever.
Along with this feature, the interface also gets a few updates. Try it today and feel the difference!
What is Local JSON?
Recognizing the power of JSON files for configuration and data management, we introduced the feature to register blocks using block.json
files last year. Today, local JSON takes it further by boosting performance and synchronization for your custom fields in Meta Box.
Local JSON is a mechanism for saving field groups’ essential information and settings as JSON files within your theme. It helps to prioritize loading the field group information from your theme (also meaning your local) instead of the database.
This brings many benefits to your web management:
- Faster loading time: Local JSON helps reduce database queries, so your website's performance will be improved.
- Effortless version control: Data is stored in JSON files so you can easily track and manage changes using version control systems like Git or other version control tools.
- Seamless environment synchronization: Simply copy the JSON files to move the configurations of fields between staging, production, or other environments. As well as any changes will be detected and overwritten just by clicking. As a result, sharing and syncing become hassle-free.
Local JSON is especially effective for web-building teams, ensuring data consistency at all times. Even if your team includes members who prefer coding or working with a visual UI, they can all create, edit, and manage field groups with ease.
Setup Local JSON
To start using the local JSON feature, you need to create a new folder in your theme, named mb-json
. It has to be writable by the server.
A New Optimal Way to Create a Field Group
Previously, you had two methods to have a field group: using code or using MB Builder with an intuitive interface. With the local JSON feature, there’s one more way: create a JSON file for the field group, then import it into the database.
For instance, I have a field group called Event Information with several fields like the below image.
Recommend: You should set the modified time to a Unix timestamp, then the version recognition may be more accurate since the version of the field group is based on the timestamp too.
Right after having a file in the folder, there is a new tab on the MB Builder interface named Sync available includes the JSON files that haven’t synced along with their paths.
For the first time you use the Local JSON fields for any field group, look for the status of the wanted field group. There will be a Sync button there if the JSON file is totally new. Click on it to sync data immediately. Or, you can review it via the Review button before syncing. Then, that field group will be added with all the fields and their settings as stipulated in the JSON file.
In the opposite direction, after having mb-json in your theme, every field group you publish in the database will be generated as a new JSON file automatically in that folder.
So, what are the benefits of this approach?
As you may know, working with JSON lets you quickly bulk-import or bulk-edit fields, change settings, or copy configurations. Therefore, this method helps you save time and effort while still having a visual UI when needed. As a result, your team collaboration is better, especially if there are both developers and those who prefer working with the interface.
Directly loading data from the JSON file makes your custom fields and website run faster and more stable.
Easy and Seamless Synchronization
The JSON Sync feature is the most powerful and essential feature of Meta Box local JSON. It means that you can create, configure, and edit a field group in both the Meta Box admin and JSON file without hassle, and then, data will be saved in both places.
JSON syncing empowers you to import field groups, review the changes, and sync data between JSON files and the database with just one click. In the case that there are two different versions of a field group, the JSON files are always given loading priority for the best performance.
Pay attention to the new column named Sync status column. It indicates whether the version of the field group in the JSON file matches the database. So, there are two statuses for it:
Synced: The version of the field group in the JSON file is the same as in the database. This state appears even when you change the field settings in the JSON file, as long as the version remains unchanged. So, anytime you edit the JSON file, don’t forget to update its modified time.
Sync available: This status appears when the field group is in one of the three cases below:
- The JSON file hasn’t been imported to the database. Just sync as normal.
- The field group was created with MB Builder before creating
mb-json
in your theme. - The versions in two storages are different. You should review the changes and sync them to have a consistent version. Therefore, you can see two quick actions below the status, they are Sync and Review. When clicking on the Review button, there is a popup showing the difference between the field group version and data of both storages.
In summary, if you edit the field settings in the JSON file, Meta Box local JSON allows you to review and sync changes.
Conversely, when you edit the field group in the database (on the UI as well), the JSON file will be updated automatically.
So, from now on, the field configurations will remain consistent and easy to manage. Whether where you are pushing changes from, this seamless synchronization process helps prevent version conflicts and keeps your workflow efficient and organized. With the added ability to review and confirm changes before applying them, you gain full control over your data and version management.
Other Improvements
Besides the highlight feature, Meta Box also supports JSON schema. It provides an even more optimized and developer-friendly workflow. In detail, JSON schema helps ensure data validity through suggestions and supporting autocompletion. Thanks to that, you can save time and effort significantly.
Moreover, we also simplified the JSON file format. It’s the same with field group registration. Improved readability and quicker editing are the key strengths of this format.
All of these features are available in the MB Builder 4.10 version. You can update and experiencing the local JSON feature right now.
Last Words
Meta Box Local JSON is more than just a performance boost. It’s a game-changer for how you manage and synchronize custom field configurations. Our purpose is to improve for a better experience. This is also the request that we received from users.
You also can explore the sync feature of block.json
to create, register, and sync your custom blocks.
Now, let’s update the newest version and explore this powerful feature. Feel free to comment on your thoughts or any requests you want. Thanks for reading.