Giter Site home page Giter Site logo

visualjsoneditor's Introduction

Visual JSON Editor

Build status

Visual JSON Editor is a JSON schema draft v4 based file editor for Windows: When opening a JSON file, the application auto-generates an editor GUI based on the provided JSON schema. The goal is to make JSON editing more effective and easier for users.

Download latest Visual JSON Editor installer (MSI)

Article describing a usage scenario

Tip: Use the NJsonSchema library to generate JSON Schemas from your C# classes.

Visual JSON Editor is developed by Rico Suter using the MyToolkit and NJsonSchema libraries.

visualjsoneditor's People

Contributors

bitdeli-chef avatar dannylane avatar indigo744 avatar mjamro avatar ricosuter avatar unclepaul84 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

visualjsoneditor's Issues

Editor-added elements at depth 3 are not accessible

When creating elements at depth 3 with VJE, those elements are always of value "{}" and cannot be edited.
Attached is a minimal example for observing this error (you can add elements to the "int list", but not change the value of those elements).
When the "int list"-elements are in the JSON-file already when loading it with VJE, their values show and can be edited as expected; they are also preserved when saving.

minimal_error.json.txt

Crash when closing not required object

I have the following schema:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "title": "Room Schema",
  "type": "object",
  "properties": {
    "Furniture_Element": {
      "title": "Furniture Element",
      "description": "Furniture Element (Type) - chair, sofa, table, cupboard, blackboard",
      "type": "string"
    },
    "Dimension": {
      "title": "Room Size",
      "type": "object",
      "properties": {
        "X": {
          "description": "X-Position of room relative to floor",
          "type": "integer",
          "minimum": 0
        },
        "Y": {
          "description": "Y-Position of room relative to floor",
          "type": "integer",
          "minimum": 0
        },
        "Width": {
          "description": "Width of room",
          "type": "integer",
          "minimum": 1
        },
        "Height": {
          "description": "Height of room",
          "type": "integer",
          "minimum": 1
        }
      },
      "required": [
        "X",
        "Y",
        "Width",
        "Height"
      ]
    },
    "FurniturePosition": {
      "title": "Position Furniture",
      "type": "object",
      "properties": {
        "X": {
          "title": "X Pos",
          "description": "X-Position of furniture",
          "type": "integer",
          "minimum": 0
        },
        "Y": {
          "title": "Y Pos",
          "description": "Y-Position of furniture",
          "type": "integer",
          "minimum": 0
        },
        "Width": {
          "description": "Width of furniture",
          "type": "integer",
          "minimum": 1
        },
        "Height": {
          "description": "Height of furniture",
          "type": "integer",
          "minimum": 1
        },
        "ImageFile": {
          "title": "Image Path",
          "description": "Path to representational image",
          "type": "string"
        }
      },
      "required": [
        "ImageFile"
      ]
    },
    "Windows": {
      "description": "When set to true the room additional has windows",
      "type": "boolean"
    }
  },
  "required": [
    "Furniture_Element",
    "FurniturePosition",
    "Windows"
  ]
}

When I create a new file and edit it I have the option to specify values for "Dimension (Object)".
I click on this option.
Next I decide I don't need this option and click on it again.
Then I get the message "VisualJsonEditor has stopped working".

I have VS 2013 on my system installed. The Debugger tells me that
"NotImplementedException" was unhandled. Pressing "Continue" quits the Debugger.
There is no call stack.

Default values being assigned to nullable/optional members

Hiya, I love this program, but as I'm getting deeper into it I'm running into some bad pain-points.

If I open a json file with a given schema, and the type is

[
  "string",
  "null"
]

and save, it saves it as "" even if I didn't change anything. This is particularly bad if I have a format associated, since I get errors for violating the format... when I wouldn't violate the format if it had been left null or missing.

This is also bad for "format": "date-time" values, since there it's even setting in midnight year 0 when the value is supposed to be null.

Unable to cast object of type 'Newtonsoft.Json.Linq.JObject' to type 'Newtonsoft.Json.Linq.JValue'.

I have an object with multiple properties (all of them the same type)

at VisualJsonEditor.Models.JsonObjectModel.FromJson(JObject obj, JsonSchema4 schema) in \src\VisualJsonEditor\Models\JsonObjectModel.cs:line 98
at VisualJsonEditor.Models.JsonObjectModel.FromJson(String jsonData, JsonSchema4 schema) in \src\VisualJsonEditor\Models\JsonObjectModel.cs:line 62
at VisualJsonEditor.Models.JsonDocumentModel.<>c__DisplayClass28_0.b__0() in \src\VisualJsonEditor\Models\JsonDocumentModel.cs:line 120
at System.Threading.Tasks.Task`1.InnerInvoke()
at System.Threading.Tasks.Task.Execute()

additionalProperties do not work

The following example (taken from https://cswr.github.io/JsonSchema/spec/objects/) does not work:

{
	"type": "object",
	"properties": {
		"first_name": {"type": "string"},
		"last_name": {"type": "string"}
	},
	"additionalProperties": {
		"type": "integer"
	}
}
{
	"first_name": "Gary",
	"last_name": "Medel",
	"age": 25
}

The file is correctly validated, but the "age" property is not shown in the editor, and neither is it possible to add new properties (allowed by the schema). Also, if I change "age" to "25" (a string), the JSON is still validated, even if it is invalid. It even validates with additionalProperties: false...
In other words, it looks like the additionalProperties keyword is ignored in the schema.
I have also tested patternProperties and it does not work either,

I could understand if you did not want to have additional properties in the editor (since without additionalProperties: false, one can add anything anywhere), but it would be nice if the validating worked correctly and also if the already present (and valid) keys we shown in the editor...

Error opening Sample.schema

I have just installed the editor.
When I choose "New" with the included Sample.schema, I get the following error: Unable to cast object of type 'System.String' to type 'Newtonsoft.Json.Linq.JValue'.

system: Windows 10 Enterprise, 64-bit

Unhappy user experience

After installing VisualJsonEditor.msi there was no way to run the software. JSON files did not have a context menu entry and no link to the executable file seems to have been created.

I searched to find the executable (it was in the 32-bit software folder) and ran it.

The program showed a clumsy view of a sample JSON file. I navigated to my own JSON file and it showed a completely empty pane.

This software evidently has not been tested and I cannot recommend it. This software is several years old, yet did not work for me. It is not clear whether it is currently being supported or not.

Errors editing Json file

Hi, I am serializing and de-serializing successfully from and to a C# object using Json.Net. No schema is used.
Visual Studio Code and NotePad++ both load and display the file happily but your product refuses with:
image
I don't know if you are still supporting the product but thought you should know.
A very short extract from the file is below. There can be multiple base elements with multiple "Timesheet Lines" elements in each base element

[
  {
    "EmployeeID": "22241b17-164d-410e-ac96-dca8baf01d82",
    "StartDate": "2016-07-05T00:00:00",
    "EndDate": "2016-07-11T00:00:00",
    "Status": 2,
    "Hours": 0.0,
    "TimesheetLines": [
      {
        "EarningsRateID": "ae0ca6e1-359e-45f0-92f0-0cab5de3a592",
        "TrackingItemID": "00000000-0000-0000-0000-000000000000",
        "NumberOfUnits": [
          8.00000,
          7.30000,
          7.25000,
          7.50000,
          0.0,
          0.0,
          8.00000
        ]
      }
      ]
   }
]

"Specify values" with default value crashes the editor

The following simple schema crashes the editor, after clicking on "Specify values" under "prop-tree":

{
  "type": "object",
  "properties": {
    "prop-tree": {
      "type": "object",
      "properties": {
        "start-time": {
          "type": "string",
          "default": "2016010100"
        }
      }
    }
  }
}

system: Windows 10 Enterprise 64-bit

Schema Editing

When opening any json file the editor immediately requires me to open a schema.
However I don't have a schema. So I cannot edit it at all with that editor.

My wish is an enhancement in this direction. I see two possibilities:

  1. Add full-blown schema editing (preferred)

  2. Use optionally a generator to create a schema from the loaded json file.

    -> There are several schema generators available like npm
    -> However you might need need to add a setting for the npm binary path

Errors in using VJE src in Visual Studio 2017 Community

Hi,
I downloaded your latest source as I wanted to see if an enhancement was possible. I notice no changes for quite a while.
First there were unloaded NuGet packages. Reloaded them. 5 packages were back level, but initially I did not update them.
Next, the WPF designer would not load MainWiIndow because of several errors for which I cannot see the reason.
Same result after I updated the back-level NuGet packages.
I just wanted to see what is involved in turning the Schema property descriptions into a multiline word-wrapped text field. As an alternative, or as well, I would like to show any Schema (v7) $comment fields in your GUI. I use quite a few json files to configure a complex application. Using VJE has been a great help to our consultants already. I would like to improve its self-documentation in the Schema to get rid of most external documentation, as well as its value in validation and field xrefs..

Eric Whitchurch

support items[] properties

Hi,items[] properties seems not to be supported.

the JsonSchema4 file looks like this below
{
"type": "object",
"properties": {
"fixedItemsList": {
"type": "array",
"title": "A list of fixed items",
"items": [
{
"title": "A string value",
"type": "string",
"default": "lorem ipsum"
},
{
"title": "a boolean value",
"type": "boolean"
}
],
"additionalItems": {
"title": "Additional item",
"type": "number"
}
}
}
}
you can also find it in tab[Arrays] from https://mozilla-services.github.io/react-jsonschema-form/
It can't be opened in VisualJsonEditor.

Regards.

VJE wrongly claims document is not valid

In a small example, VJE claims a document is not valid, even though other validators say it is OK.
It seems to require several objects, even if they are not marked as "required" in the schema.

InvalidCastException

Every single actually not sampleish json I open reports this:

System.InvalidCastException: Cannot convert 'Newtonsoft.Json.Linq.JArray' to 'Newtonsoft.Json.Linq.JObject'.
at VisualJsonEditor.Models.JsonObjectModel.GetSchemaProperty(String filePath) at C:\projects\visualjsoneditor\src\VisualJsonEditor\Models\JsonObjectModel.cs:line 75
at VisualJsonEditor.ViewModels.MainWindowModel.<>c__DisplayClass59_0.<b__1>d.MoveNext() at C:\projects\visualjsoneditor\src\VisualJsonEditor\ViewModels\MainWindowModel.cs:line191

at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at MyToolkit.Mvvm.ViewModelBase.<>c__DisplayClass13_0.<b__0>d.MoveNext()

at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at MyToolkit.Mvvm.ViewModelBase.d__12`1.MoveNext()

"Error converting value "True" to type 'System.Collections.Generic.ICollection`1[System.String]"

I'm getting the following error when I attempt to load my JSON file with what I believe is a valid JSON Schema:

Error converting value "True" to type 'System.Collections.Generic.ICollection`1[System.String]'. Path 'properties.Name.required', line 5, position 22.

I have attached the JSON Schema file, and a sample JSON file that contains the data for your reference.

My system is a Windows 10 PC (Insider Fast Ring, 14376) and v1.4.5944.34935 of your Visual JSON Editor.

HPOneView.300_CmdletHelp.json.txt
Test.json.txt

Standalone executable

Hello

Can you please provide standalone executable, i'm not a fan of installer for small executables

crash when deselecting "Specify values" of an array with added item

Example schema:

{
	"$schema": "http://json-schema.org/draft-04/schema#",
	"type": "object",
	"properties": 
	{
		"branching": 
		{
			"type": "array",
			"title": "Tree branching",
			"items": 
			{
				"type": "object",
				"title": "One branching",
				"properties": 
				{
					"time": 
					{
						"type": "string",
						"title": "Time"
					},
					"branches": 
					{
						"type": "integer",
						"title": "Number of branches"
					}
				}
			}
		}
	}
}

Steps to reproduce:

  1. Select new file with the above schema
  2. Select "branches" and "Specify values"
  3. Click on "Add"
  4. De-select "Specify value"

On my machine (Win 10 64, VJE v. 1.8), this crashes the editor.

Blank view

When I open a json file a second open file dialogue pops asking me to select a json file. When I do the close and validate become clickable but the work area is completely blank no matter what json file i pick.

Win8 btw

VJE fails to open file it itself validated and saved

In the following example, VJE fails to open the file, with the following error: vje_error
However, the file was created in VJE and validated before (and after) it was saved.

Note: the difference from a working file is that two empty lists were completely removed by de-selecting their "Specify values" checkbox.

Could not resolve the JSON path

I've compiled the program from source and trying to load the following JSON:

https://raw.githubusercontent.com/usnistgov/oscal-content/master/examples/ssp/json/ssp-example.json

With the following Schema:

https://raw.githubusercontent.com/usnistgov/OSCAL/main/json/schema/oscal_ssp_schema.json

When I load the files, I get the following error in the compiler:

"Could not resolve the JSON path '#assembly_oscal-ssp_system-security-plan' within the file path '<PATH>'."

And then this error comes up when I continue execution:

image

I've checked the JSON against the schema and it validates correctly.

No valid document

thanks for the msi fix
tried to load my json file, a list of entries like this:

[
{
"servoName": "leftHand.thumb",
"arduino": 0,
"servoId": 0,
"pin": 2,
"minComment": "open",
"maxComment": "close",
"minDegrees": -120,
"maxDegrees": 120,
"autoDetach": 1000,
"restDegrees": 0,
"enabled": true,
"servoType": "MG996R",
"cableTerminal": 0,
"wireColorArduinoTerminal": "",
"wireColorTerminalServo": ""
},
...
]
but get this error:

image

how can a string be too short? Are the empty strings a problem?

Juerg

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.