JSON Documents in Grid View

www.altova.com Expand/Collapse All Print this Topic Previous Page Up One Level Next page

Home >  User Guide and Reference > JSON, JSON Schema >

JSON Documents in Grid View

Grid View enables you to see the structure of the JSON document (JSON instance/schema or Avro schema) in a grid and to restructure blocks of structured text. This provides you with an overview and editing capability that is not always present in Text View, especially in the case of long and complexly structured documents. In the case of JSON documents, such complexity can occur in the form of arrays and objects being nested within other arrays and objects at multiple levels. For example, compare the JSON text listed below (as it would appear in Text View) and its representation in Grid View (as shown in the screenshot further below).

 

Note:Avro support is available in the Enterprise Edition only.

 

Click to expand/collapseJSON code listing in Text View

{

  "web-app": {

  "servlet": [

    {

        "servlet-name": "altovaCDS",

        "servlet-class": "org.altova.cds.CDSServlet",

        "init-param": {

        "configGlossary:installationAt": "Philadelphia, PA",

        "configGlossary:adminEmail": "ksm@pobox.com",

        "configGlossary:poweredBy": "Altova",

        "configGlossary:poweredByIcon": "/images/altova.gif",

        "configGlossary:staticPath": "/content/static",

        "templateProcessorClass": "org.altova.WysiwygTemplate",

        "templateLoaderClass": "org.altova.FilesTemplateLoader",

        "templatePath": "templates",

        "templateOverridePath": "",

        "defaultListTemplate": "listTemplate.htm",

        "defaultFileTemplate": "articleTemplate.htm",

        "useJSP": false,

        "jspListTemplate": "listTemplate.jsp",

        "jspFileTemplate": "articleTemplate.jsp",

        "cachePackageTagsTrack": 200,

        "cachePackageTagsStore": 200,

        "cachePackageTagsRefresh": 60,

        "cacheTemplatesTrack": 100,

        "cacheTemplatesStore": 50,

        "cacheTemplatesRefresh": 15,

        "cachePagesTrack": 200,

        "cachePagesStore": 100,

        "cachePagesRefresh": 10,

        "cachePagesDirtyRead": 10,

        "searchEngineListTemplate": "forSearchEnginesList.htm",

        "searchEngineFileTemplate": "forSearchEngines.htm",

        "searchEngineRobotsDb": "WEB-INF/robots.db",

        "useDataStore": true,

        "dataStoreClass": "org.altova.SqlDataStore",

        "redirectionClass": "org.altova.SqlRedirection",

        "dataStoreName": "altova",

        "dataStoreDriver": "com.microsoft.jdbc.sqlserver.SQLServerDriver",

        "dataStoreUrl": "jdbc:microsoft:sqlserver://LOCALHOST:1433;DatabaseName=goon",

        "dataStoreUser": "sa",

        "dataStorePassword": "dataStoreTestQuery",

        "dataStoreTestQuery": "SET NOCOUNT ON;select test='test';",

        "dataStoreLogFile": "/usr/local/tomcat/logs/datastore.log",

        "dataStoreInitConns": 10,

        "dataStoreMaxConns": 100,

        "dataStoreConnUsageLimit": 100,

        "dataStoreLogLevel": "debug",

        "maxUrlLength": 500

      }

    }, {

        "servlet-name": "altovaEmail",

      "servlet-class": "org.altova.cds.EmailServlet",

      "init-param": {

        "mailHost": "mail1",

        "mailHostOverride": "mail2"

        }

    }, {

      "servlet-name": "altovaAdmin",

      "servlet-class": "org.altova.cds.AdminServlet"

    }, {

      "servlet-name": "fileServlet",

      "servlet-class": "org.altova.cds.FileServlet"

    }, {

      "servlet-name": "altovaTools",

      "servlet-class": "org.altova.cms.AltovaToolsServlet",

      "init-param": {

        "templatePath": "toolstemplates/",

          "log": 1,

          "logLocation": "/usr/local/tomcat/logs/AltovaTools.log",

          "logMaxSize": "",

          "dataLog": 1,

          "dataLogLocation": "/usr/local/tomcat/logs/dataLog.log",

          "dataLogMaxSize": "",

          "removePageCache": "/content/admin/remove?cache=pages&id=",

          "removeTemplateCache": "/content/admin/remove?cache=templates&id=",

          "fileTransferFolder": "/usr/local/tomcat/webapps/content/fileTransferFolder",

          "lookInContext": 1,

          "adminGroupID": 4,

          "betaServer": true

      }

    }

  ],

  "servlet-mapping": {

    "altovaCDS": "/",

    "altovaEmail": "/altovautil/aemail/*",

    "altovaAdmin": "/admin/*",

    "fileServlet": "/static/*",

    "altovaTools": "/tools/*"

  },

  "taglib": {

    "taglib-uri": "altova.tld",

    "taglib-location": "/WEB-INF/tlds/altova.tld"

  }

}

}

 

 

 

While the document structure in Text View (listing above) is difficult to make out without a longer, more careful reading, the structure in Grid View (screenshot below) is more readily seen at a glance.

JSONGridView

Additionally, the structure can be easily modified by adding, deleting, or moving objects in the grid. Entire blocks of text can be reorganized (for example, by sorting them or moving them). Content, too, can be edited in Grid View. For a detailed explanation of how to work with structured text in Grid View, see the section Grid View.

 

Auto-completion

Auto-completion is enabled when the JSON document (JSON instance/schema or Avro schema) being edited is associated with a schema.

 

If the document is a JSON schema, then auto-completion is based on the schema version indicated by the $schema keyword. For more information, see also JSON Schema Version.
If the document is a JSON/JSON5 instance, then a JSON schema must be assigned to the instance in order for auto-completion to be enabled.
If the document is an Avro data document in JSON format, then an Avro schema must be assigned to the instance for auto-completion to work.
If the document is an Avro schema, then it is automatically associated with the schema for Avro Schema, and auto-completion is based on this schema.

 

Auto-completion provides you with the available entry options at the cursor location. It does this (i) via pop-ups in the main window, and (ii) via the entry helpers (see screenshot below). The pop-ups and entry helpers each display a list of entries that are valid at that cursor location. To move through the entries in the pop-up list, use the arrow keys. Select an entry from the pop-up window or double-click an entry in the entry helper to insert it.

JSONAutoCompPropsGV

In the instance document shown in the screenshot above, the pop-up window and JSON Properties entry helper are shown when the cursor is located in the third property's name field. The entry helper displays all the properties allowed at that point; the properties that have already been entered are shown grayed out and disabled. The pop-up displays only the properties that are allowed at that point.

 

There are two other entry helpers: JSON Values and JSON Entities (screenshot below). These show, respectively, the allowed values of key:value pairs and entities for escaping characters in JSON strings. The JSON Values entry helper in the screenshot below shows the values allowed for the type keyword while editing a JSON schema. The last entry in the JSON Entities entry helper, \u00FF, is a placeholder that stands for a Unicode character. Replace the part highlighted in blue with the code of the Unicode character you want.

JSONAutoCompEntryHelpers

Other context-sensitive auto-completion entries or hints include the following (if these are specified in the schema): enumerations, descriptions, required occurrences, and default values.

 


© 2019 Altova GmbH