JSONBuddy help pages

New Project
User guide
×

  • JSONBuddy help pages
  • Next page

JSONBuddy

JSON development environment

User guide
2022
Made with help of Dr.Explain
(c) Company name, 2019


General

The JSONBuddy desktop application offers a lot of JSON related functionality for your daily work with JSON documents and JSON Schema. The tool includes an enhanced File Explorer, an editor tab and a Large File Viewer to give you convenient access to all of your JSON documents.
With JSONBuddy you can edit, validate, format and transform multiple JSON files with just a few clicks. All of the functionality is easy to use that also people without a deeper knowledge about JSON are able to edit and validate any number of documents.
At a glance, you can use JSONBuddy for the following tasks:
  • •
    JSON text editor
    Create and edit JSON with syntax-coloring, auto-completion and well-formed checking.
  • •
    JSON validator
    Validate your JSON data against JSON Schema definitions with a single click.
  • •
    Convert between XML, JSON and CSV formats
    Import CSV data and convert between XML and JSON. Create CSV from JSON.
  • •
    JSON Schema editor
    Design and check standard compliant JSON Schemas.
  • •
    JSON Schema debugger
    Learn how a JSON Schema is applied in detail to your JSON data.
  • •
    JSON grid editor
    The built-in grid editor makes it easy to always create well-formed JSON data with no syntax errors.
  • •
    JSON Schema validation
    Check your JSON input with the JSON Schema standard.
  • •
    Generate JSON schema documentation
    View any schema as tree diagram and generate HTML documentation with a single click.
Made with help of Dr.Explain
(c) Company name, 2019


File Explorer view

The File Explorer view in JSONBuddy is a central place to work with your JSON data. To quickly find a Folder from the history just start to enter any part of the path you are looking for at the Explorer edit field on the left side. The screen-shot below shows the list of suggested entries from the history of all visited paths if you enter "Examples" (for this user).
You can also use the Folder-browse button [image] to set a path for the Explorer window. The Explorer view starts to load a list of all files and folders if a valid path is available.
The Explorer window allows to arrange the order and to set the width of each column separately. Those settings will be restored on the next start of the application. This way it is possible to modify the appearance of the view to fit special needs.
If "Search in sub-folders" is checked the list will also contain all files in all sub-folders of the current path. This feature gives quick access to all files even in deeply nested directory trees. Reading a lot of files from all sub-folders can take a while. Therefore it is possible to stop this process at any time by simply removing the check from the "Search in sub-folders" option again.
Searching
It is possible to find specific files by name or other options with the Find-edit of the File Explorer view:
The edit field is used to input the search string and supports the common * and ? wildcards. The existing list of items is reduced immediately to a list of items matching the search string. Use the red "X" button to clear find results and get all files and folders of the current path again.
Made with help of Dr.Explain
(c) Company name, 2019


Editor in a nutshell

New Project
User guide
×

  • Editor in a nutshell
  • Previous page
  • Next page

The contents of Editor in a nutshell

Open or create a JSON document
How to use the JSON validator
Instant validation while editing JSON data
Using JSON pretty-print
Made with help of Dr.Explain
(c) Company name, 2019


Open or create a JSON document

There are several ways to create a new JSON file or to open already existing JSON data in JSONBuddy:
1. The "New" command (Ctrl-N)
2. Create a new JSON schema with "File | New... | JSON schema"
3. Generate a new sample JSON document from any schema at schemastore.org
4. Create sample JSON data from a schema loaded in the editor
5. Open multiple documents from the built-in File Explorer
1. The "New" command
This is the usual "New" command as you know it from any other text-based editor. Of course, you can also quickly invoke it with Ctrl-N. It immediately opens a new JSON document and sets the focus to the active view.
2. Create a new JSON schema with "File | New... | JSON schema"
Are you working with JSON schemas a lot? Save time and create a new JSON schema in the editor with the "File | New... | JSON schema" command. You can also assign a keyboard shortcut (like Ctrl-Alt-N) on the "Keyboard" page of the "Tools | Customize..." dialog to the menu item. The benefit of the new JSON schema command is, that it already fills the schema content with some template text and marks the document as "JSON schema". So you don't have to do this on creating a new schema.
3. Generate a new sample JSON document from any schema at schemastore.org
JSONBuddy can load any JSON schema available at schemastore.org in the editor as a document. Those schemas are a great resource to learn how others are designing JSON data and the related specifications. But JSONBuddy also provides an easy method to quickly generate a sample JSON instance from a schema from schemastore.org. Just set the check-box on the "File | Open from JSON schema library..." dialog:
Open from JSON schema library and create instance
4. Create sample JSON data from a schema loaded in the editor
You can also create sample JSON data as a new document from the active JSON schema in the editor with the "JSON | Generate sample document from JSON schema" menu item. Did you also notice, that the Preview window always shows updated JSON sample data while you are editing your schema in JSONBuddy?
5. Open multiple documents from the built-in File Explorer
JSONBuddy comes with a convenient built-in File Explorer window beside the standard Open command (Ctrl-O) to load files from disk. A usual way is to select multiple files in the explorer and to open them at once in the editor. This is not very special. But one of the best features of the built-in File Explorer in JSONBuddy is the folder history. The editor remembers the last folder paths from where you opened documents and you can browse this history by just typing in the current path edit field:
Search file explorer folder history
A simple and fast way to find all your recent JSON documents.
Cycle through open documents
You can cycle through open documents in backwards and forwards using Ctrl+Tab and Ctrl+Shift+Tab.
Made with help of Dr.Explain
(c) Company name, 2019


How to use the JSON validator

1. Open the JSON document and assign a schema
Before the JSON validator can be used in the editor to check JSON data, a JSON schema must be assigned to the instance. Set the schema at the "JSON schema" field on the "Quick Associations" window of JSONBuddy. The assignment is saved and restored for the active document.
  • •
    Use the "File | Open..." command or double-click the JSON document in the built-in File Explorer.
  • •
    Assign the schema to the JSON instance at the "Quick Associations" pane.
  • •
    The editor will remember the assigned JSON definitions automatically.
  • •
    Once a schema is assigned to the document, the instant validation will start to run in the background and shows any error immediately. You can read more about the background validation here.
2. Optionally modify the JSON data
Use the JSON editor environment if you want to do any modifications to the content before you run the validator to check if the JSON data is valid. Intelligent entry-helpers provide information from the assigned schema.
  • •
    JSON specific syntax-coloring for increased readability.
  • •
    Context sensitive entry helpers provide schema information.
  • •
    Folding and brace highlighting makes it easy to navigate through the JSON structure.
  • •
    You can also use the JSON grid editor .
3. Run the JSON validator to find any errors
To run the validator press the F11 key or use the "Validate JSON" command either from the JSON menu or click the toolbar button. This command is only enabled if a JSON schema is assigned to the active document.
  • •
    The JSON validator reports all validation or well-formed errors at once.
  • •
    Errors and warnings are reported in the Results pane of the editor.
  • •
    You can copy the complete error report to the clipboard using the "Copy results" command from the context-menu of the Results pane.
  • •
    Background validation is also available if a JSON schema is assigned to the current document
4. Fix any validation errors with the built-in JSON editor
After the validation, use the editor window to modify the JSON content. If any errors were reported by the JSON validator, a click on the results entry selects the related position in the editor window. A detailed error description helps to fix the problem in the JSON content. Press F11 or use the "Validate JSON" command again to see if all of the reported problems are corrected.
  • •
    Jump-to-error functionality to quickly fix any parsing or validation errors.
  • •
    The validator will report the error position in the JSON data and the violated schema rule.
  • •
    The error description also includes the violated schema rule for this entry.
  • •
    You can also use the JSON pointer evaluation window to check location paths.
Made with help of Dr.Explain
(c) Company name, 2019


Instant validation while editing JSON data

Are you tired of clicking the "Validate" button or pressing F11 every time you want to know if your JSON data has still some validation errors? With JSONBuddy, you don't need to run the JSON validator explicitly anymore while you are working on your JSON data in the editor. Instead, you always get all issues displayed as text indicators instantaneously and directly in the JSON editor window. You also get the error message shown as call-tip if you hover with the mouse over the indicator for a short while:
JSON validator runs in the background in the editor
Instant validation at any time
This allows a new way of working with JSON documents in JSONBuddy. You just open the JSON and if there is already a schema assigned, you can immediately see if the JSON data has errors or not. And to make it easier to fix any issues and to know what values are actually available for the enumeration, the editor will also display an entry-helper if you are going to fill the property:
Enum values from the assigned JSON schema
So in summary, you always see any errors immediately and you get instant help if you want to fix them in the editor while you are editing your JSON data. Both make working with JSON more convenient and helps to save time.
Made with help of Dr.Explain
(c) Company name, 2019


Using JSON pretty-print

Maybe, you often have to deal with JSON data which is not formatted as you like or has no whitespace at all. As an example, it is hard to edit this JSON text in the editor:
JSON data with no whitespace
What you need is an editor that a) understands the JSON syntax and b) can quickly format your JSON data hassle-free.
Format JSON data with no whitespace in the editor
In JSONBuddy, just use the pretty-print feature to format the current text content at any time. The keyboard shortcut for the pretty-print command is Ctrl+Shift+p (you can change the shortcut in the "Options..." dialog). There is also a menu item at "JSON | Pretty-print JSON". After the formatting, the JSON data is much more readable and can be easily modified in the editor:
Note that short array content is aligned at a single line. This makes the JSON more compact and is saving space in the editor window. This is also true for arrays with only primitive types and having no long string values. As a consequence, arrays with many items of only primitive types, often numbers, are still displayed in a compact way with no new-lines separating the single items. In contrast, arrays with long string values are displayed with each item on a new line to increase the readability. The editor applies an adaptive JSON formatting based on the actual content.
Use pretty-print in combination with the navigation history
The pretty-print functionality is getting even more powerful in combination with the navigation history of the JSON editor. If you format your JSON data while you are adding new properties, objects or arrays, the navigation history sets the text selection to the current property, after you applied the formatting operation.
You can also use the "Navigate Backward Ctrl+Shift+," and "Navigate Forward Ctrl+Shift+." commands to navigate through the selection history as you need.
Made with help of Dr.Explain
(c) Company name, 2019


JSON editor environment

New Project
User guide
×

  • JSON editor environment
  • Previous page
  • Next page

The contents of JSON editor environment

JSON text editor
JSON grid editor
The Elements pane
The Schema Info pane
Made with help of Dr.Explain
(c) Company name, 2019


JSON text editor

Use the "Editor" tab in JSONBuddy to open and edit JSON documents. The editor provides JSON specific syntax-coloring, intelligent auto-completion, background validation and well-formed checking. Of course all of the standard editor functionalities like copy-paste and find or replace are also available in the text editor view for JSON documents.
JSON auto-completion
The JSON intelligent auto-completion feature learns which object and value names are used in the currently active JSON document. On starting a new name with a leading " (quote) character, a list of already used names is presented in a standard auto-completion window for quick selection. This saves a lot of time on editing and modifying any JSON document.
Validation using JSON Schema
Please learn more about JSON validation here: How to use the JSON validator
JSON well-formed checking
To make sure that the current JSON content of the active document follows the JSON syntax, you can use the "Check if JSON well-formed" (F10) command from the JSON menu or from the main toolbar. This will also report if any property names are not unique at the same level.
And we get a message like this in the standard results dialog of the editor:
Hint: To check multiple JSON documents at once just select them in the File Explorer window of JSONBuddy (or JSONBuddy) and use the "Check if JSON well-formed" command from the JSON menu or use the toolbar button.
JSON pretty-print
Use the "Pretty-print JSON" command from the JSON menu to convert any JSON input into a more readable layout. This can help a lot on editing a JSON document and avoids adding errors to the content. Because only well-formed JSON can be pretty-printed, this command will also detect syntax errors in the document.
Remove whitespace from JSON
Any well-formed JSON can be converted to a compact format to reduce the amount of characters which is used to save the document. The resulting JSON will be printed as a single line without any line-breaks.
"Unescape JSON" command
This command will remove any JSON escaping from the current selection or from the whole document if the selection is empty.
JSON Pointer evaluator
Use the built-in JSON Pointer evaluator to quickly test and create valid JSON pointer expressions for your JSON document. If the pointer evaluates to a location in the current document the editor will select the corresponding line. Please note that you get entry-helpers if the JSON schema can be evaluated for the current JSON pointer:
Made with help of Dr.Explain
(c) Company name, 2019


JSON grid editor

Use the grid view in JSONBuddy to open and edit well-formed JSON documents. The grid editor also provides JSON specific syntax-coloring and intelligent auto-completion. Of course all of the standard editor functionalities like copy-paste and find or replace are also available in the gird editor. You can use the "Grid view" command from the toolbar or from the View menu to switch to the grid editor at any time. If the JSON content contains syntax errors the text view will show the results of the well-formed check. You need to resolve all of them before you can activate the grid editor for JSON.
Expand and collapse objects and arrays
The plus and minus signs in the left corner of any JSON object or array allows to collapse and expand any element. The collapsed status of any child object will be remembered. On expanding any parent element all children will be displayed according to their previous state. Please use the "Collapse selection" command from the context menu to collapse the current selection and all children. Use the "Expand selection" command to expand all of the current selection.
Next to any parent property, the number of child nodes are displayed to the right:
Setting and moving the selection
A single click using the left mouse button selects any element in the grid editor. You can then move the current selection with the keyboard arrow keys (up, down). Please take a look at the samples below to learn more about the different selection states:
In this case the complete "author" array is selected. Any copy/paste operation would affect the whole array. Pressing Delete would also remove the complete array from the grid view.
This selection points to the upper insertion location of the "author" array. A paste operation would insert any content right before the "author" array.
In this case the lower insertion point is selected. A paste operation would insert any content right after the "author" array.
Extending the selection with SHIFT and CONTROL keys
You can extend the current selection using the mouse together with the SHIFT and CONTROL keys. Holding down the SHIFT key will select all elements at the same level between the current left mouse button click position and the existing selection. Holding down the CONTROL will only add a single element next to the current selection.
Drag and drop
Holding down the left mouse button at the current selection and moving the mouse will start a drag and drop operation. The cursor will turn into a hand to signal that a drag and drop operation is now executed. Release the left mouse button at the position where you want to move the current selection. In the picture below the object will be moved between the first and the second element of the "author" array:
The drag and drop position is shown in orange and follows the same style as the selection insertion points from above.
Quick editing using the TAB and ENTER keys
The TAB and ENTER keys can be used to quickly move the edit field and to insert a new value. The TAB key will move the edit field to the next possible name, caption or value. You can immediately continue editing at the next JSON content. The ENTER key will insert a new value right after the current edit field.
Set the type of a JSON value
A JSON value can have one of the following types: string, number, boolean and null. The selected type affects how the JSON content is written as text. Only the string type will get surrounding quotes. You set the type of a value using the selection field on the right side of the name area:
A single click at the existing symbol will show the selection field. T = string, # = number, B = boolean, 0 = null
Context menu
Use the context menu for the most common tasks while editing your JSON data. You can also see the currently assigned keyboard shortcuts of the commands from there. The context menu will open after a click with the right mouse button.
Command | Description
Copy value(s) with no character escaping | Copy all selected JSON values from the same level in Grid view without any JSON escaping.
Made with help of Dr.Explain
(c) Company name, 2019


The Elements pane

The Elements pane gives a quick overview which properties are defined and available at the current level in the JSON structure.
The first column shows the name of the property. A bold name indicates that the property is required.
The second column shows the type of the property.
A third column shows a hint to the schema location where this property is defined.
On clicking an entry in the Elements info pane the related JSON schema definition is loaded and displayed.
Made with help of Dr.Explain
(c) Company name, 2019


The Schema Info pane

Once a JSON schema is assigned to the current JSON document, the JSON Schema Info window shows additional information for the current selection:
The Schema Info shows various details about the current property:
  • •
    The type of the current property.
  • •
    A list of enumeration values if available.
  • •
    Additional information of the current format like the current pattern.
The "Show definition" button jumps to the definition in the assigne JSON schema document. The side-by-side view (Menu command "View | Split editor window) for two open documents next to each other can be especially useful together with this functionality.
Made with help of Dr.Explain
(c) Company name, 2019


JSON Schema support

New Project
User guide
×

  • JSON Schema support
  • Previous page
  • Next page

The contents of JSON Schema support

JSON Schema editor
Open JSON schemas from schemastore.org
JSON Schema debugger
JSON Schema analyzer
Generate JSON schema documentation
Made with help of Dr.Explain
(c) Company name, 2019


JSON Schema editor

In order to help people writing JSON schemas, JSONBuddy provides special syntax-coloring and auto-completion for schema keywords together with a built-in validator.
To tell the editor that you are working on a JSON schema, simply use the "Quick Associations" pane and set the "Current document is a JSON Schema" checkmark. From this moment on the editor knows that this JSON document should be treated as JSON schema:
You will notice that the way JSON syntax-coloring works changes immediately after telling the editor that the current JSON content is actually a schema. All of the schema keywords are now green and all of the keywords are also present in the auto-completion. The picture below shows how the library JSON schema sample, which is also part of the installation, is displayed afterwards in the editor. JSON Schema keywords like "properties" or "description" appear in green, while arbitrary names like "bib" are still in red. This improves the readability of the schema in the editor a lot and helps on editing the document:
Auto-completion is also a very important feature and helps tremendously on creating and editing any text-based standard. As you can see on the previous screenshot, the editor provides a list of JSON schema keywords also for the entry-helper popup.
JSON schema specification text in Schema info window
The full JSON schema specification text is shown as interactive help text in the Schema info window while the current selection is at a schema keyword.
Validation of JSON Schema files
To validate JSON Schema documents the editor provides a built-in schema for schemas. If the current document is marked as JSON schema the "Validate against JSON Schema" command will use the built-in schema to detect errors in the active schema. This makes it easy to create error free JSON schemas in less time. The sample has been modified in a way that the built-in JSON schema validator reports an error. As you can see on the screenshot the "required" keyword array contains a wrong value type. The editor will point you to the error location in the schema and also shows the exact description in the "Results" pane at the bottom. You can jump to the error position at any time on clicking the entry in the Results window:
Preview of generated sample data
The text Preview is filled with the generated JSON sample data from the current JSON schema. This sample data is updated while you are editing the schema.
Quickly test JSON instance files while editing the schema
To check a JSON document against any JSON Schema, enter the path to the JSON schema at the "JSON Schema" field of the "Quick Associations" pane when the JSON instance is the active document. Now the editor keeps a reference to the schema for this instance document. It is also possible to put a relative path here. If both documents are located in the same folder just enter the name of the schema here. Whenever you use the "Validate against JSON Schema" command the schema content is either loaded from disk or directly taken from the editor and the validation results appear in the "Results" pane. This makes it possible to quickly test the schema while it is still open in JSONBuddy for editing.
In addition, the background validation also shows any errors as indicators in the text view. The error message is shown when you move the mouse over the property in the JSON instance. This happens while you are editing your JSON schema and your JSON data side-by-side:
Most of the reported errors also contain the location as JSON pointer. Simply click on the error in the Results window to use the jump-to-error functionality and to go to the position where the error was detected in the JSON content by the JSON validator.
Quickly create a sample document from a JSON schema
Use the "Generate sample document from JSON schema" command to create a new JSON document directly from the generated sample data based on the current JSON schema. If the JSON schema is already saved to disk and has a file path, the JSON schema is also assigned automatically to the new JSON instance document (the path is added to the "Quick Associations" settings). This command is only enabled for JSON schemas.
Made with help of Dr.Explain
(c) Company name, 2019


Open JSON schemas from schemastore.org

You can instantly load all JSON schema files from schemastore.org in JSONBuddy. All you need to do is to use the "File | Open from JSON schema library..." command to show the open dialog which reads all available schema documents from the public schema store. This list is updated from schemastore.org everytime you start JSONBuddy.
Open JSON schema from library dialog
schemastore.org is a great resource to learn how others are writing JSON schemas and can help a lot on providing own specifications for your JSON data. After the schema is loaded in JSONBuddy, the editor will automatically generate JSON sample data. You can immediately create a new document from the sample data using the "JSON | Generate sample document from JSON schema" command.
In addition, the unique built-in JSON schema analyzer will start to report any issues it can find about the schema.
Made with help of Dr.Explain
(c) Company name, 2019


JSON Schema debugger

Use the JSON Schema debugger to step through the validation process and learn how a schema is applied to your JSON. The debugger is available with the JSONBuddy Plus edition of the editor.
Starting the JSON validation debugger
Set the JSON instance for debugging as the active document in the editor window and use the "Debug validation" command from the Toolbar to start the debugger. As a prerequisite, the instance document needs to have a JSON Schema assigned. The JSON editor will then arrange the instance document to the left and the root JSON Schema file to the right. The locations of the first validation steps are marked with yellow arrows in the left margin areas of the editor windows. The current lines are also indicated with an alternative background color. Therefore, the current validation step is always clearly visible.
Debugging commands
The debugger toolbar
You can find all of the usual debugger commands in the toolbar. Often it will be quicker to use the keyboard. Press F8 for a single step and Ctrl+F8 to run until the next breakpoint or validation error. There is also an option to toggle if the debugger should break whenever a validation error occurred.
A breakpoint can be set in the instance document and any referenced JSON Schema file with the right-mouse-click context menu in the text editor window.
Set a breakpoint in the JSON instance document
Debugging stopped at a breakpoint
Getting a deeper understanding of the JSON Schema validation process is not the only reason to use the debugger. It can save a lot of time on getting a schema ready for production. But don’t forget to restart the debugger session if you modify any of the JSON Schema files.
Editing the JSON input data while debugging
Furthermore, it is possible to edit the JSON data while the debugger session is still active. Jump from error to error to resolve and fix any issues in the instance. In order to give additional details about the error, all of the usual context information and indicators are also available while running the debugger. As a consequence, it is often easy to apply the fix.
Fixing the error and continuing with debugging
Please note, that major changes to the structure of the JSON input can result in making it impossible for the debugger to find any subsequent error locations. In this case, it is recommended to restart the validation in the JSON editor.
Made with help of Dr.Explain
(c) Company name, 2019


JSON Schema analyzer

JSONBuddy is the only JSON editor that has a built-in JSON schema analyzer as your assistant while you are editing your JSON schema documents.
The analyzer runs in the background and reports any issues immediately:
Currently, the JSON editor can report the following issues as errors, warnings or simple messages:
1. Undefined type in schema branch - Reported if a type definition is missing.
2. Unknown type specifier - Often a typo. An unknown type specifier is used.
3. Unknown schema keyword - A schema keyword is found, which is not known for this schema draft.
4. Ambiguous schema keyword - A schema keyword is used more than once at the JSON schema branch.
5. Unresolved local $ref - Extremely useful. The JSON pointer of the $ref can't be resolved.
6. Unresolved external $ref - Also for external schema references. The referenced schema can't be loaded.
7. Recursive $ref - A message about a recursive $ref.
8. Empty required array - Only for draft 4. Any empty required array is reported.
9. Required property not found in schema branch - This one can be tricky. A required property is not defined at the current schema branch.
10. Empty "not" - An empty "not" can actually never be satisfied.
11. Empty "pattern" - The "pattern" field for string types is not filled.
12. Field multiple defintions - A schema field has multiple definitions.
13. "maximum" less "minimum" - The "minimum" field is greater than the "maximum" value.
14. "maxLength" less "minLength" - For strings, "maxLength" value is less than "minLength".
15. Array fields but no array type - Schema fields related to arrays are used but no array type is specified.
16. Unused definitions - There is a definition which is never used in the local schema.
17. Multiple defintions of property - A property is defined one more than once at the JSON schema branch.
Please note some of them are just messages like reporting an empty required array, some are warnings and others are reported as errors like an unresolved $ref. As usual, if you click at one of the entries, the selection jumps to the location in the JSON schema based on the reported JSON pointer.
Made with help of Dr.Explain
(c) Company name, 2019


Generate JSON schema documentation

Use the "View | Schema view" command or the toolbar button to switch to the JSON schema view (currently read-only) to generate a nicely looking tree diagram of your JSON schema. If the current JSON content contains syntax errors the text view will show the results of the well-formed check. You need to resolve all of them before you can activate the JSON schema view. You can expand and collapse parts of the schema to get a better overview of the JSON structure:
Use the "Generate JSON schema documentation (HTML)" command to create a new document in the editor which contains the generated HTML. The HTML documentation uses SVG to keep the diagram scalable to any size. After you have saved the document with the generated documentation you can open it directly in your browser.
Made with help of Dr.Explain
(c) Company name, 2019


Enhanced JSON schema functionality

New Project
User guide
×

  • Enhanced JSON schema functionality
  • Previous page
  • Next page

The contents of Enhanced JSON schema functionality

Custom formats for the JSON validator
JSON editor and validator for large schemas
Made with help of Dr.Explain
(c) Company name, 2019


Custom formats for the JSON validator

With JSONBuddy, 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
How to add and use custom formats?
Use the "JSON | 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. Please note that you can also replace existing formats which are already provided by the JSON validator of JSONBuddy. A user-defined format will override 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 to provide two simple strings to add a custom format. The identifier of the new format and a (valid) regular expression. After you have finished adding your new entries you simply save the configuration file and activate the new formats with the "JSON | 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 on editing your JSON data in the editor:
"library" example with custom format definition
The "library" example, which is part of the standard installation, also uses a custom format. Just check it out and play around with different regular expressions.
Made with help of Dr.Explain
(c) Company name, 2019


JSON editor and validator for large schemas

Sometimes it can happen that a JSON schema is generated from existing data and the resulting schema is quite huge. And maybe this schema is just taken as a starting point and you need to extend or modify it to get the final specifications for your JSON input.
One example of a really huge JSON schema is the FHIR schema available from https://build.fhir.org/downloads.html (Please take a look at here to see how easy it is to open any schema also from schemastore.org in JSONBuddy). The FHIR schema has currently more than 60.000 lines and 3 MB of JSON text. For this task, you need a good JSON editor which can also handle quite large files.
Editor support for large schemas
JSONBuddy is capable of loading big schema documents. The editor will apply syntax coloring, entry-helpers, and code folding as it does for a typical schema. You also don't have to work on your schema without the context-sensitive help to get the specification text for the keyword you are currently editing. All of this is also functional for big schemas. Please note that the schema you are working on must be completely validated once before any context-related information can be provided.
Use the code folding feature of the text view to increase the readability of the schema content while editing your definitions.
Inserting a new definition in a JSON schema with more than 60k lines
Performance options
It can be useful to turn off some of the background tasks before you open a large JSON Schema document. This can further increase performance of the editor environment. Please use the options from the "Tools | Performance" menu to enable or disable certain background tasks.
Made with help of Dr.Explain
(c) Company name, 2019


Pretty-print and remove whitespace for large JSON data

What do you do if you need to compact a JSON document but the file has more than 400 MB and 20 Million lines? Or the other way around, you have a large document and it is impossible to read because it has no formatting? In such situations you need a JSON editor which can do two things for you: a) The editor can open and view really large text files and b) it needs to know how to format or compact your JSON data. Luckily, JSONBuddy can do both for you.
No input size limit
Pretty-print and Remove Whitespace are using a full streaming approach for reading all JSON input and writing the generated JSON output.
Select your large JSON data
Simply select your large JSON document in the built-in File Explorer window. You can also select multiple files if you need to do this for several documents:
Remove whitespace from big JSON data
Remove whitespace from your large JSON documents
Run either the "Pretty-print JSON" or "Remove whitespace from JSON" command from the JSON menu. JSONBuddy will save the output document next to the original JSON with a new file name. The original file content is not modified on your disk. Both commands can also applied on the current document in the editor.
Made with help of Dr.Explain
(c) Company name, 2019


Convert JSON array to CSV dialog

Use the "JSON | Convert JSON to CSV file..." command to convert JSON input to CSV tables. This command is enabled after selecting a file in the built-in "File Explorer" or an active document is loaded on the Editor tab. To start the conversion, use the dialog to set various options to locate the JSON array and to format the CSV output.
To avoid size limitations, the conversion process is using a full streaming mode for reading all JSON input and writing the generated CSV output.
A JSON to CSV conversion can be started for the current document and also for (multiple) files selected in the built-in File Explorer window. To use the File Explorer, select one or more files in the list and use the "Convert JSON to CSV file..." command from the right-click context menu of the Explorer window.
Convert JSON array to CSV dialog

Set location of JSON array as JSONPointer

1. Set location of JSON array as JSONPointer
JSON pointer to set the location of the array where the conversion process will start. The right-click context menus of the text and Grid views provide commands to copy the JSONPointer of the current selection to the clipboard. Use those commands to make it simple to set the location of the JSON array.
Top

Enabled for current document

2. Enabled for current document
This button is enabled if the current document is converted to CSV and a valid JSONPointer for the current selection is available. On clicking this button the current JSON pointer is copied to the location field.
Top

Scan input button

3. Scan input button
Reload column definitions from JSON input according to the current settings.
Top

Set limit of JSON array items for column definitions

4. Set limit of JSON array items for column definitions
Set a limit of array items to scan for column definitions. Remove the check to scan the complete JSON input for column definitions.
Top

Include child objects and values in output

5. Include child objects and values in output
For objects, all child properties are also included in the generated output.
Top

Load column definitions

6. Load column definitions
Load definitions from disk as JSON array.
Top

Save definitions to disk

7. Save definitions to disk
Save definitions to disk as JSON array.
Top

List of columns in output

This list contains all of the JSON values which will be converted to CSV. You can add values set as JSONPointers using the "Add" and "Remove" buttons. The column labels are actually JSONPointer fragments relative to the starting level within the JSON input.
Top

Update preview with current settings

9. Update preview with current settings
The CSV output preview is reloaded using the current conversion options.
Top

Preview of generated output

10. Preview of generated output
Top

Add column definition

11. Add column definition
Top

Remove

Top

Move column up

13. Move column up
Top

Down

Top

Options to set column separator

15. Options to set column separator
Top

Output encoding

16. Output encoding
Please select the encoding that should be used on writing the CSV output. By default a standard ASCII encoding is used.
Top

Create header row toggle

17. Create header row toggle
Add a header line with column labels to the CSV output.
Top

Start conversion process

18. Start conversion process
Top
In general, the conversion process takes all JSON values it can find at a specific array in the JSON document. This location can be the root of the JSON data or any other valid JSONPointer.
A list of JSON values is updated whenever the "Scan input" button is clicked. The list of column definitions can also be used to change the order in the CSV output, to remove values from the output and to add values which were not detected automatically. Use the "Remove" button to skip a JSON value in the CSV output. In order to move a value up or down select the value from the list and use the "Up" or "Down" buttons.
The "Take from selection" button is enabled if the dialog was opened from an active document on the Editor tab. In this case the JSON pointer location is taken from the current selection in the JSON data.
To generate the actual output, use the "Convert" button. This will open a new document in the editor with the conversion results as CSV. Afterwards you can save the CSV data with the standard "File | Save" command.
Error reporting
It can happen that not all of the JSON input can be converted to CSV. For example, the JSON input could have syntax errors at a specific line. Any available CSV output is written to a new document and the standard "Results" window of the application will then display all of the reported errors. Please note that not all of the JSON input is converted in this case.
Made with help of Dr.Explain
(c) Company name, 2019


How to convert CSV files to JSON or XML

CSV is a popular format for tabular data and can be used to export and convert from many sources like Excel or databases to JSON and XML. To make it easy to work with CSV, JSONBuddy can convert any CSV input to XML or JSON using a dialog that offers various options in a convenient way. To open the dialog use the Convert CSV file... command from the File Explorer menu.
The dialog shows a preview of the first 20 lines of the CSV input. This allows to see how the data will be imported and changing any related options like the column separator updates the preview immediately.
There is also the output preview which shows how the input CSV data will be converted to XML or JSON. To generate the actual output use the "Convert" button. This will open a new document in the editor with the conversion results in XML or JSON.
Options for the CSV input
Column seperator
The CSV import supports three different column separators:
  • 1.
    Semicolon
  • 2.
    Comma
  • 3.
    Tabulator
Encoding
Please select the encoding according to the CSV input. By default a standard ASCII encoding is selected.
Header line
Many CSV files contain a header line to set the column labels. If the current input comes with a header line, set this option to read the column labels from the first line. Also the import will then start from the second line.
Edit column labels
Below the header line option is a list of column labels. Use the check-box in each line to include or exclude the column in the output. In addition the label text can be edited. The output preview will show the changes to the column labels immediately.
Options for the XML or JSON output
Output format
The CSV data can be converted into XML or JSON using this option.
Conversion methods
JSONBuddy supports several methods what JSON or XML structure will be created from the imported CSV data. The following methods are available for the generated JSON:
  • 1.
    A JSON object as array item for each CSV row
  • 2.
    A JSON array for each CSV row
  • 3.
    A JSON array for each CSV column
On creating XML output:
  • 1.
    An element for each CSV row
Made with help of Dr.Explain
(c) Company name, 2019


JSON/XML conversions

JSONBuddy can convert XML to JSON and also from JSON to XML with a single click. To transform XML documents to JSON use the "Convert XML to JSON" command from the XML menu, for JSON to XML conversions use the "Convert JSON to XML" command from the JSON menu.
Convert the current document
Simply use the conversion commands from the XML or JSON menu to transform the active document to the other format. If the conversion was successfully the result is opened in a new document directly in the editor. The new document can be modified and saved afterwards.
Additional options for XML to JSON conversions
There are several options available to enhance the XML to JSON conversion process. With JSONBuddy you can apply a stylesheet to the XML before the XML is converted. This way you can easily transform the input or take only XML nodes you are interested in:
It is also possible to add prefixes to all attribute names coming from the XML. This allows to distinguish between element nodes and attributes also in the JSON output. In order to keep all namespace prefixes in JSON please check the "Keep namespace prefix" option. Otherwise all prefixes will be removed from the output.
Running conversions from the built-in File Explorer
JSONBuddy will convert all files selected in the File Explorer from XML to JSON. Regardless of the file extension the conversion process assumes that all selected files are XML documents and JSONBuddy tries to convert them to the JSON file format. After a document has been converted, a JSON well-formed check is applied to the output file to make sure that the generated text is readable JSON.
The converted JSON document gets the same file title with only the file extension replaced with .json. If there is already a file present with this name, the conversion is not executed and no document is written. In this case a message is added to the results window.
Use the "Convert JSON to XML" command from the JSON menu to convert any number of JSON documents to XML. The process is basically the same as the one from the XML to JSON conversion.
Made with help of Dr.Explain
(c) Company name, 2019


Web Service Query window

The Web Service Query window allows to send quickly HTTP requests to any URL and to test and retrieve the response data. If the response is well-formed XML or JSON, the integrated Grid is filled automatically. Any fragment of the response can also copied to the clipboard using the standard Ctrl-C keyboard command. In addition, the raw text response is also written to the Header and Body tabs.
1 Toolbar to send request
1. "Send command": This command sends the HTTP request to the target URL.
2. "Create document from response": If any response data is present, this command created a new JSON or XML document in the editor.
2 Text field to enter URL
Multi-line edit field to enter the URL. This URL can also contain the HTTP query string parameters. This Url is restored on loading the application the next time.
3 Select HTTP method
Used to select the HTTP verb for the request.
4 Checkbox to set request data
On setting this checkbox, the content of the currently active document is sent as additional request data to the URL.
This allows to switch quickly between multiple versions of request data by simply changing the active document.
5 Response data
The response field contains the information retrieved from the last HTTP request. If the content is either well-formed XML or JSON,
the Grid tab shows the structured data. In any case, the Header and Body tabs are filled with the raw text response. The response data from the Grid can also be copied using Ctrl + C.
Made with help of Dr.Explain
(c) Company name, 2019


Custom user tools

Custom user tools are a great way to enhance the functionalities of JSONBuddy and to offer the user new possibilities to work with JSON files.
In general it is possible to call any executable, Java class or XSL transformation and to pass different arguments to the external tool. To add, delete or modify a custom user tool open the Options dialog from the Tools menu and select the "Tools setup" page.
A custom user tool is also a great way to link your favorite text editor to JSONBuddy. This enables you to quickly edit your JSON files while JSONBuddy is still open to do any JSON related task. The screenshot below shows how to add the popular text editor Notepad++ to the application:
Please note that you should put the path argument which is passed to the external tool in quotes to avoid problems if the path contains spaces. Several pre-defined variables can be accessed with the ">" button on the right side of the "Arguments" field.
One-click XSL transformations are also possible using a custom user-tool. Please note that you should not encapsulate arguments in quotes in this case as the parameters are only used internally and not passed to any external tool.
If "Show tool as button" is checked the custom user-tool will be added as button to the bottom of the File Explorer view. A user-tool can also be invoked by command if the "Show tool in Explorer tab menu" is checked.
Made with help of Dr.Explain
(c) Company name, 2019


Tales from support

New Project
User guide
×

  • Tales from support
  • Previous page
  • Next page

The contents of Tales from support

Spaces for indentation
Setting the default view for JSON documents
Open large data in the JSON editor
Picking the right editor view for large JSON data
JSON code folding
Made with help of Dr.Explain
(c) Company name, 2019


Spaces for indentation

During the development of JSONBuddy 4.5 we got a customer inquiry about the need to use spaces instead of tabs for indentation levels in the JSON editor. So we added this setting to the "Editor" page of the "Options" dialog:
Option to use tab or space for indentation
If you remove the check from the "Use tabs for indentation" check-box, the editor will insert spaces to set the indentation level for every new line. This setting is also used for JSON pretty-print and the various conversion operations of JSONBuddy.
Please keep in mind that this doesn't replace any tabs which are already inserted. Any existing JSON data with either spaces or tabs as indentation will keep the characters currently used. In addition, the indentation functionality copies the white-space characters from any previous line. So don't be confused if any new line has still tab characters inserted because the previous line uses tabs as indentation. Any new document in the JSON editor will use the setting from above right from the start.
Made with help of Dr.Explain
(c) Company name, 2019


Setting the default view for JSON documents

How do you change the default view in the JSON editor? You can easily set the default view, either Grid or Text, using the "File extensions" page of the "Options" dialog:
File extensions page of the Options dialog
You can do this for each file extension separately. It is also possible to add new extensions to the list and there is also an option to set the format, XML or JSON, of the file type.
The customer also suggested adding a new setting to the editor: "Create new document on startup". Maybe I'm going to add this option to the application. It is our main goal to provide the best JSON editor experience as possible. However, you can also always press Ctrl-N to quickly create a new document in the JSON editor.
Made with help of Dr.Explain
(c) Company name, 2019


Open large data in the JSON editor

I got the following user feedback from the survey page, which is loaded in the default web browser, on running the uninstaller of JSONBuddy:
It reported that the large JSON file I wanted to view was too large.
Unfortunately, I can't clarify this issue with the user who sent the feedback because she or he left no email address. I wonder what dialog or message caused the confusion on opening large JSON data in the editor? Actually, the JSON (text) is always opened either in the standard view or using the special Large File view. Maybe the following dialog was confusing for the user:
Info dialog on opening a large file
This dialog appears if the user tries to open large text data in the JSON editor for the first time. It tells the user, that there is also a special view available for huge text documents and that it can take a while to open big files (usually if they have more than 50 MB ...) in the standard view of the editor.
However, in any case, the document is opened in the editor afterward.
Made with help of Dr.Explain
(c) Company name, 2019


Picking the right editor view for large JSON data

A user sent me an inquiry about opening large JSON data in JSONBuddy. This can be indeed a little bit tricky if the default view for JSON data is set to the Grid view in the editor settings. Not all data is suitable to be displayed in the Grid view. JSON with a lot of child properties at the same parent could take a lot of processing time and memory if you want to show the JSON as Grid in the editor. So the user wanted to get some help:
I don’t believe this is a fault in your software, as all other editors seem to be overwhelmed by the 450,000 rows as well… I was just curious if you had any tips that may help improve the performance of this application…. As without better performance, I cannot justify purchasing a license.
And I replied:
450,000 rows in total is not that much as I’m frequently working with files with several millions of lines. I recommend to use the text view modes of JSONBuddy (and XML ValidatorBuddy) if you are working with really large files. Using the text view, the editor supports two modes. The standard view which loads all of the file content and the Large File view which always only keeps parts of the content in memory.
Set the default view to text for large data
As a first step set the text view as the default view for your large (JSON, XML or any text format) data. Please learn more about this here.
Set a limit in MB for the Large File text view in the editor
How can you set the limit for the Large File view? There is a setting in the Options dialog on the Editor page which sets the limit in megabytes for using the standard view:
Option to set the limit for the Large File view
Any file larger than the limit will be loaded in the Large File view. Using the Large File view it is no problem to browse files even with a size of several GBs. Please note that you would need a plus license of XML ValidatorBuddy (a Plus version of JSONBuddy with support for large file editing will be available in the near future) if you want to edit the file as well. In general, avoid the Grid view for large data and use the Large File view in the text editor.
Made with help of Dr.Explain
(c) Company name, 2019


JSON code folding

Someone who set "Recommend: yes" and "Overall quality: 1" (best) on the survey form sent the additional following feedback:
Code folding for JSON file does not work for situations like: "RaceCar": { "Domestic": true, "Model": [] }
Unfortunately, the user did not provide an email address so I couldn't get in contact with her/him. So what is the JSON editor doing with JSON data like this in terms of code folding? The sample data is all on one line. There is actually no chance for the editor to show code folding for JSON content which spans over a single line.
Use JSON pretty-print to show code folding
However, if you are using JSONBuddy as your JSON editor you also get a very useful pretty-print functionality which can be quickly executed by just pressing Ctrl-Shift-P. The sample JSON is immediately formatted in the following way:
Formatting JSON with pretty-print in JSONBuddy
As you can see, folding is available after the JSON data is formatted in the editor. It is also convenient that the current selection is also preserved after the pretty-print operation is completed. Maybe a small but important detail to provide the best JSON editor experience as possible.
Made with help of Dr.Explain
(c) Company name, 2019