Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-21024

Not clear how to validate JSON with Qt Creator

    XMLWordPrintable

    Details

    • Commits:
      6ff6189cb5b3a61a93d10bcce6f0ebec39c8fc09 (qt-creator/qt-creator/4.10)

      Description

      http://lists.qt-project.org/pipermail/qt-creator/2018-August/007481.html

      I recently checked if Qt Creator supports any kind of JSON validation (e.g. JSON lint). I found this page:

      http://doc.qt.io/qtcreator/creator-checking-code-syntax.html#checking-json-data-structure

      Quoting the section:

      “You can run static checks on the QML and JavaScript code in your project to find common problems.

      Qt Creator validates instances of JSON entities against A JSON Media Type for Describing the Structure and Meaning of JSON Documents. However, Qt Creator does not understand the entire specification.

      A JSON schema defines the structure of JSON data. It determines what JSON data is required for an application and how to interact with it.

      The specification does not define how to map JSON instances with JSON schemas. Qt Creator looks for a JSON schema file with a name that matches the name of the JSON instance file in the user configuration folder. For example, ~/config/QtProject/qtcreator/json on Linux and macOS and C:\Users\username\AppData\Roaming\QtCreator\qtcreator\json in Windows. To check JSON data structure, copy the JSON schema file to the above folder.”

      Does this mean that if I want to validate a regular JSON file, I need to have my own schema? Why not provide a default schema so that there is an equivalent to the results that e.g. JSON lint would give? Just for kicks, I tried running Ctrl+Shift+C with a JSON file open (which couldn’t be loaded by QJsonDocument due to errors), but Creator didn’t show any entries for it in the Issues pane.

        Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            • Assignee:
              leenam Leena Miettinen
              Reporter:
              mitch_curtis Mitch Curtis
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Gerrit Reviews

                There are no open Gerrit changes