Uploaded image for project: 'Qt Creator'
  1. Qt Creator

Not clear how to validate JSON with Qt Creator



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



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


      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.


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



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


              • Created:

                Gerrit Reviews

                There are no open Gerrit changes