Why Do We Use JSON Format With IntelliJ

Posted By : Shivani Pandey | 08-Jun-2023

ERP Java Java Virtual Machine javascript

Loading...

JSON

The JSON format is normally used for storing statistics and for configuration documents. IntelliJ concept allows you to figure with JSON files — it tests their syntax and formatting. In popular forms of configuration files, the IntelliJ concept offers code crowning glory, thanks to the JSON Schema, which is a unique layout for describing the shape and contents of such files. you could moreover use custom JSON Schemas to allow code of entirety on your JSON documents and validate them.



Enabling JSON5
IntelliJ idea recognizes a number of maximum famous JSON requirements including JSON5. IntelliJ idea by way of default treats files with the json5 extension as JSON5 files and helps this new syntax in them.

Note:

config/superior is the superior configuration, it overwrites little by little in Namespace Order.

config/*.EXT is the highest priority configuration, follows the Namespace Order, and overrides the superior configuration

The same filename with different file ext, the priority order is yaml > json > json5 > js.

For different file paths, the priority order is . > /

json the ext file format is the same as json5.

Import
import config from 'config-json5'

config.Customer.dbConfig
config.get('Customer.dbConfig')
config.has('Customer.dbConfig')

Also, ReadAn Introduction To Stream In Java 8


Expand The JSON5 Syntax To All JSON Files

In the Settings dialog (Ctrl+Alt+S), go to Editor | File Types.



Within the diagnosed file sorts list, choose JSON5
In the File Name Patterns area, click plus and type *.json in the Add Wildcard dialog that opens.

Using schemas from JSON Schema Store
IntelliJ idea can robotically download and use schemas from the JSON Schema and keep that host's schema documents for lots of famous configuration files. As soon as you open a document whose name is related to one of the available schemas (as an instance, tslint.json), the IntelliJ concept downloads and uses this schema for it. The call of the applied schema is shown on the repute bar.

By using the default, the automated download of Schemas from the JSON Schema keeps is enabled. If it turned into grew to become off, you could permit it once more at any time.
allow computerized download schemas from the JSON Schema to keep


In the Settings dialog (Ctrl+Alt+S), go to Languages & Frameworks | Schemas and DTDs | Remote JSON Schemas.

choose the allow downloading JSON schemas from remote resources and the Use schemastore.org JSON Schema catalog checkboxes.

IntelliJ idea comes bundled with some of the famous schemas. even though those schemas are mechanically updated on a normal foundation they still can also occur to be outdated


Use the up-to-date versions of bundled schemas

In the Settings dialog (Ctrl+Alt+S), go to Languages & Frameworks | Schemas and DTDs | Remote JSON Schemas.

Select continually to download the maximum current model of the schemas checkbox.



2. Using custom JSON schemas

You could download the specified schema and shop it beneath the challenge root or specify the URL of the resource so the IntelliJ concept can download the schema automatically.



3. Configure a custom JSON schema

In the Settings dialog (Ctrl+Alt+S), go to Languages & Frameworks | Schemas and DTDs | JSON Schema Mappings.

Inside the critical pane, that suggests all of your previously configured custom Schemas, click on the toolbar.

Specify the decision of the Schema and the Schema Specification version with which your Schema complies. In the Schema record or URL area, specify the vicinity of a formerly downloaded Schema report or kind of the URL at which the specified schema is to be had.

If you specify a URL, ensure the Allow downloading JSON schemas from a ways-flung assets checkbox at the some distance-off JSON Schemas page is chosen.
four. Create a listing of documents or folders that you want to be established for this Schema. The listing may also comprise the names of particular files, the names of whole directories, and filename patterns. primarily based on the list, IntelliJ idea internally detects the documents to be tested.

Also, ReadAn Overview of Java ArrayList


4. To add an item to the list, click + and specify the path to a file or folder or type a file pattern

Enable automated download of JSON schemas from faraway sources
In the Settings dialog (Ctrl+Alt+S), go to Languages & Frameworks | Schemas and DTDs | Remote JSON Schemas.

Pick the permit downloading JSON schemas from remote resources.

When the checkbox is cleared, any network activity around JSON Schemas, such as schemas from the JSON Schema shop, is disabled.


Using HTML Descriptions In JSON Schema

Through default, the IntelliJ idea escapes HTML characters even as displaying documentation for JSON schema definitions in documentation popups.

description - x-intellij-html-description

{
"id": "http://some.site.somewhere/entry-schema#",
"$schema": "http://json-schema-org/draft-06/schema#",
"type": "object",
"required": [ "options" ],
"properties": {
"options": {
"type": "array",
"description": "Interesting details: Fresh New Awesome",
"minItems": 1,
"items": { "type": "string" },
"uniqueItems": true,
},
"readonly": { "type": "boolean" }
}
}

Configuring syntax highlighting
You could configure JSON-aware syntax highlighting according to your possibilities and habits.


In the Settings dialog (Ctrl+Alt+S), go to Editor | Color Scheme | JSON.

Pick the shade scheme, accept the highlighting settings inherited from the defaults, or personalize them as described in colorations and fonts.