├── src
├── VisualJsonEditor
│ ├── Localization
│ │ ├── Strings.fr.Designer.cs
│ │ ├── Strings.pl.Designer.cs
│ │ ├── Strings.pl.resx
│ │ ├── Strings.fr.resx
│ │ └── Strings.resx
│ ├── FileIcon.ico
│ ├── SplashScreen.png
│ ├── ApplicationIcon.ico
│ ├── Images
│ │ ├── ButtonAboutLarge.png
│ │ ├── ButtonAboutSmall.png
│ │ ├── ButtonCloseLarge.png
│ │ ├── ButtonCloseSmall.png
│ │ ├── ButtonExitSmall.png
│ │ ├── ButtonOpenLarge.png
│ │ ├── ButtonOpenSmall.png
│ │ ├── ButtonRedoSmall.png
│ │ ├── ButtonSaveLarge.png
│ │ ├── ButtonSaveSmall.png
│ │ ├── ButtonUndoSmall.png
│ │ ├── ButtonCreateLarge.png
│ │ ├── ButtonCreateLarge2.png
│ │ ├── ButtonCreateSmall.png
│ │ ├── ButtonCreateSmall2.png
│ │ ├── ButtonValidateLarge.png
│ │ ├── ButtonValidateSmall.png
│ │ ├── ButtonConfigurationLarge.png
│ │ └── ButtonConfigurationSmall.png
│ ├── Properties
│ │ ├── Settings.settings
│ │ ├── AssemblyInfo.cs
│ │ ├── Settings.Designer.cs
│ │ ├── Resources.Designer.cs
│ │ └── Resources.resx
│ ├── App.xaml
│ ├── Samples
│ │ ├── Sample.json
│ │ └── Sample.schema.json
│ ├── packages.config
│ ├── Converters
│ │ ├── DateTimeConverter.cs
│ │ ├── DecimalUpDownRangeConverter.cs
│ │ ├── IntegerConverter.cs
│ │ ├── DateConverter.cs
│ │ ├── TimeConverter.cs
│ │ ├── IndexConverter.cs
│ │ ├── IntegerUpDownRangeConverter.cs
│ │ └── NumberConverter.cs
│ ├── Messages
│ │ ├── OpenJsonDocumentMessage.cs
│ │ └── SaveJsonDocumentMessage.cs
│ ├── Views
│ │ ├── AboutWindow.xaml.cs
│ │ ├── AboutWindow.xaml
│ │ ├── MainWindow.xaml.cs
│ │ └── MainWindow.xaml
│ ├── App.config
│ ├── Models
│ │ ├── JsonTokenModel.cs
│ │ ├── JsonValueModel.cs
│ │ ├── JsonPropertyModel.cs
│ │ ├── JsonDocumentModel.cs
│ │ └── JsonObjectModel.cs
│ ├── ApplicationConfiguration.cs
│ ├── Controls
│ │ ├── ExpandingGroupBox.cs
│ │ ├── JsonObjectTypeTemplateSelector.cs
│ │ ├── JsonEditor.xaml.cs
│ │ └── JsonEditor.xaml
│ ├── Themes
│ │ └── Generic.xaml
│ ├── App.xaml.cs
│ ├── Utilities
│ │ └── JsonApplicationConfiguration.cs
│ ├── VisualJsonEditor.csproj
│ └── ViewModels
│ │ └── MainWindowModel.cs
├── .nuget
│ ├── NuGet.exe
│ ├── NuGet.Config
│ └── NuGet.targets
├── VisualJsonEditor.sln
└── VisualJsonEditor.Installer
│ ├── VisualJsonEditor.Installer.wixproj
│ └── Product.wxs
├── assets
├── FileIcon.png
├── ApplicationIcon.png
├── ApplicationIconSite.png
├── FileIcon.metrop
└── ApplicationIcon.metrop
├── .gitignore
├── README.md
└── LICENSE.md
/src/VisualJsonEditor/Localization/Strings.fr.Designer.cs:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/VisualJsonEditor/Localization/Strings.pl.Designer.cs:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/assets/FileIcon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RicoSuter/VisualJsonEditor/HEAD/assets/FileIcon.png
--------------------------------------------------------------------------------
/src/.nuget/NuGet.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RicoSuter/VisualJsonEditor/HEAD/src/.nuget/NuGet.exe
--------------------------------------------------------------------------------
/assets/ApplicationIcon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RicoSuter/VisualJsonEditor/HEAD/assets/ApplicationIcon.png
--------------------------------------------------------------------------------
/assets/ApplicationIconSite.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RicoSuter/VisualJsonEditor/HEAD/assets/ApplicationIconSite.png
--------------------------------------------------------------------------------
/src/VisualJsonEditor/FileIcon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RicoSuter/VisualJsonEditor/HEAD/src/VisualJsonEditor/FileIcon.ico
--------------------------------------------------------------------------------
/src/VisualJsonEditor/SplashScreen.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RicoSuter/VisualJsonEditor/HEAD/src/VisualJsonEditor/SplashScreen.png
--------------------------------------------------------------------------------
/src/VisualJsonEditor/ApplicationIcon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RicoSuter/VisualJsonEditor/HEAD/src/VisualJsonEditor/ApplicationIcon.ico
--------------------------------------------------------------------------------
/src/VisualJsonEditor/Images/ButtonAboutLarge.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RicoSuter/VisualJsonEditor/HEAD/src/VisualJsonEditor/Images/ButtonAboutLarge.png
--------------------------------------------------------------------------------
/src/VisualJsonEditor/Images/ButtonAboutSmall.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RicoSuter/VisualJsonEditor/HEAD/src/VisualJsonEditor/Images/ButtonAboutSmall.png
--------------------------------------------------------------------------------
/src/VisualJsonEditor/Images/ButtonCloseLarge.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RicoSuter/VisualJsonEditor/HEAD/src/VisualJsonEditor/Images/ButtonCloseLarge.png
--------------------------------------------------------------------------------
/src/VisualJsonEditor/Images/ButtonCloseSmall.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RicoSuter/VisualJsonEditor/HEAD/src/VisualJsonEditor/Images/ButtonCloseSmall.png
--------------------------------------------------------------------------------
/src/VisualJsonEditor/Images/ButtonExitSmall.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RicoSuter/VisualJsonEditor/HEAD/src/VisualJsonEditor/Images/ButtonExitSmall.png
--------------------------------------------------------------------------------
/src/VisualJsonEditor/Images/ButtonOpenLarge.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RicoSuter/VisualJsonEditor/HEAD/src/VisualJsonEditor/Images/ButtonOpenLarge.png
--------------------------------------------------------------------------------
/src/VisualJsonEditor/Images/ButtonOpenSmall.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RicoSuter/VisualJsonEditor/HEAD/src/VisualJsonEditor/Images/ButtonOpenSmall.png
--------------------------------------------------------------------------------
/src/VisualJsonEditor/Images/ButtonRedoSmall.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RicoSuter/VisualJsonEditor/HEAD/src/VisualJsonEditor/Images/ButtonRedoSmall.png
--------------------------------------------------------------------------------
/src/VisualJsonEditor/Images/ButtonSaveLarge.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RicoSuter/VisualJsonEditor/HEAD/src/VisualJsonEditor/Images/ButtonSaveLarge.png
--------------------------------------------------------------------------------
/src/VisualJsonEditor/Images/ButtonSaveSmall.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RicoSuter/VisualJsonEditor/HEAD/src/VisualJsonEditor/Images/ButtonSaveSmall.png
--------------------------------------------------------------------------------
/src/VisualJsonEditor/Images/ButtonUndoSmall.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RicoSuter/VisualJsonEditor/HEAD/src/VisualJsonEditor/Images/ButtonUndoSmall.png
--------------------------------------------------------------------------------
/src/VisualJsonEditor/Images/ButtonCreateLarge.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RicoSuter/VisualJsonEditor/HEAD/src/VisualJsonEditor/Images/ButtonCreateLarge.png
--------------------------------------------------------------------------------
/src/VisualJsonEditor/Images/ButtonCreateLarge2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RicoSuter/VisualJsonEditor/HEAD/src/VisualJsonEditor/Images/ButtonCreateLarge2.png
--------------------------------------------------------------------------------
/src/VisualJsonEditor/Images/ButtonCreateSmall.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RicoSuter/VisualJsonEditor/HEAD/src/VisualJsonEditor/Images/ButtonCreateSmall.png
--------------------------------------------------------------------------------
/src/VisualJsonEditor/Images/ButtonCreateSmall2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RicoSuter/VisualJsonEditor/HEAD/src/VisualJsonEditor/Images/ButtonCreateSmall2.png
--------------------------------------------------------------------------------
/src/VisualJsonEditor/Images/ButtonValidateLarge.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RicoSuter/VisualJsonEditor/HEAD/src/VisualJsonEditor/Images/ButtonValidateLarge.png
--------------------------------------------------------------------------------
/src/VisualJsonEditor/Images/ButtonValidateSmall.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RicoSuter/VisualJsonEditor/HEAD/src/VisualJsonEditor/Images/ButtonValidateSmall.png
--------------------------------------------------------------------------------
/src/VisualJsonEditor/Images/ButtonConfigurationLarge.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RicoSuter/VisualJsonEditor/HEAD/src/VisualJsonEditor/Images/ButtonConfigurationLarge.png
--------------------------------------------------------------------------------
/src/VisualJsonEditor/Images/ButtonConfigurationSmall.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RicoSuter/VisualJsonEditor/HEAD/src/VisualJsonEditor/Images/ButtonConfigurationSmall.png
--------------------------------------------------------------------------------
/src/.nuget/NuGet.Config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/src/VisualJsonEditor/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | **/bin/**
2 | **/obj/**
3 | **/packages/**
4 |
5 | **.suo
6 | **.user
7 | **.DotSettings
8 |
9 | /src/VisualJsonEditor.sln.ide
10 | /src/UpgradeLog.htm
11 | /src/VisualJsonEditor.sln.GhostDoc.xml
12 | /src/VisualJsonEditor/VisualJsonEditor.previous.nugetreferenceswitcher
13 | /src/.vs/
14 |
--------------------------------------------------------------------------------
/src/VisualJsonEditor/App.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/src/VisualJsonEditor/Samples/Sample.json:
--------------------------------------------------------------------------------
1 | {
2 | "StringValue": "a",
3 | "StringValueFormatByte": "dGVzdA==",
4 | "BoolValue": false,
5 | "NumberValue": 2.3,
6 | "DateTimeValue": "2014-08-13T21:00:00",
7 | "DateValue": "2014-08-14",
8 | "TimeValue": "02:00:00",
9 | "EnumValue": "two",
10 | "IntegerValue": 1,
11 | "Test": {
12 | "Abc": "e",
13 | "Def": "d",
14 | "Geh": "d"
15 | },
16 | "List": [
17 | {
18 | "Abc": "a",
19 | "Def": "b",
20 | "Geh": "c"
21 | },
22 | {
23 | "Abc": "",
24 | "Def": "b",
25 | "Geh": "c"
26 | }
27 | ]
28 | }
--------------------------------------------------------------------------------
/src/VisualJsonEditor/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/src/VisualJsonEditor/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 | using System.Windows;
4 |
5 | [assembly: AssemblyTitle("VisualJsonEditor")]
6 | [assembly: AssemblyDescription("")]
7 | [assembly: AssemblyConfiguration("")]
8 | [assembly: AssemblyCompany("Rico Suter")]
9 | [assembly: AssemblyProduct("VisualJsonEditor")]
10 | [assembly: AssemblyCopyright("Copyright © Rico Suter, 2020")]
11 | [assembly: AssemblyTrademark("")]
12 | [assembly: AssemblyCulture("")]
13 |
14 | [assembly: ComVisible(false)]
15 |
16 | [assembly: ThemeInfo(
17 | ResourceDictionaryLocation.None,
18 | ResourceDictionaryLocation.SourceAssembly
19 | )]
20 |
21 | [assembly: AssemblyVersion("2.11.*")]
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Visual JSON Editor
2 |
3 | [](https://ci.appveyor.com/project/rsuter/visualjsoneditor)
4 |
5 | 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.
6 |
7 | **[Download latest Visual JSON Editor installer (MSI)](http://rsuter.com/Projects/VisualJsonEditor/installer.php)**
8 |
9 | **[Article describing a usage scenario](https://blog.rsuter.com/use-json-files-with-schema-for-application-configuration-2/)**
10 |
11 | **Tip:** Use the [NJsonSchema](http://njsonschema.org) library to generate JSON Schemas from your C# classes.
12 |
13 | Visual JSON Editor is developed by [Rico Suter](http://rsuter.com) using the [MyToolkit](http://mytoolkit.io) and [NJsonSchema](http://njsonschema.org) libraries.
14 |
15 | 
16 |
17 | 
18 |
--------------------------------------------------------------------------------
/src/VisualJsonEditor/Converters/DateTimeConverter.cs:
--------------------------------------------------------------------------------
1 | //-----------------------------------------------------------------------
2 | //
3 | // Copyright (c) Rico Suter. All rights reserved.
4 | //
5 | // http://visualjsoneditor.codeplex.com/license
6 | // Rico Suter, mail@rsuter.com
7 | //-----------------------------------------------------------------------
8 |
9 | using System;
10 | using System.Globalization;
11 | using System.Windows.Data;
12 |
13 | namespace VisualJsonEditor.Converters
14 | {
15 | public class DateTimeConverter : IValueConverter
16 | {
17 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
18 | {
19 | if (value == null)
20 | return null;
21 |
22 | return value is DateTime ? value : DateTime.Parse(value.ToString());
23 | }
24 |
25 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
26 | {
27 | return value;
28 | }
29 | }
30 | }
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015 Rico Suter
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/src/VisualJsonEditor/Converters/DecimalUpDownRangeConverter.cs:
--------------------------------------------------------------------------------
1 | //-----------------------------------------------------------------------
2 | //
3 | // Copyright (c) Rico Suter. All rights reserved.
4 | //
5 | // http://visualjsoneditor.codeplex.com/license
6 | // Rico Suter, mail@rsuter.com
7 | //-----------------------------------------------------------------------
8 |
9 | using System;
10 | using System.Globalization;
11 | using System.Windows.Data;
12 |
13 | namespace VisualJsonEditor.Converters
14 | {
15 | public class DecimalUpDownRangeConverter : IValueConverter
16 | {
17 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
18 | {
19 | if (value == null)
20 | return parameter.ToString() == "min" ? decimal.MinValue : decimal.MaxValue;
21 | return (decimal)value;
22 | }
23 |
24 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
25 | {
26 | return value;
27 | }
28 | }
29 | }
--------------------------------------------------------------------------------
/src/VisualJsonEditor/Messages/OpenJsonDocumentMessage.cs:
--------------------------------------------------------------------------------
1 | //-----------------------------------------------------------------------
2 | //
3 | // Copyright (c) Rico Suter. All rights reserved.
4 | //
5 | // http://visualjsoneditor.codeplex.com/license
6 | // Rico Suter, mail@rsuter.com
7 | //-----------------------------------------------------------------------
8 |
9 | using MyToolkit.Messaging;
10 |
11 | namespace VisualJsonEditor.Messages
12 | {
13 | /// Message to show the file open dialog to open a JSON document.
14 | public class OpenJsonDocumentMessage : CallbackMessage
15 | {
16 | /// Initializes a new instance of the class.
17 | /// The title to show in the dialog.
18 | public OpenJsonDocumentMessage(string title)
19 | {
20 | Title = title;
21 | }
22 |
23 | /// Gets or sets the file name.
24 | public string Title { get; private set; }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/VisualJsonEditor/Messages/SaveJsonDocumentMessage.cs:
--------------------------------------------------------------------------------
1 | //-----------------------------------------------------------------------
2 | //
3 | // Copyright (c) Rico Suter. All rights reserved.
4 | //
5 | // http://visualjsoneditor.codeplex.com/license
6 | // Rico Suter, mail@rsuter.com
7 | //-----------------------------------------------------------------------
8 |
9 | using MyToolkit.Messaging;
10 |
11 | namespace VisualJsonEditor.Messages
12 | {
13 | /// Message to show the save file dialog for a JSON document.
14 | public class SaveJsonDocumentMessage : CallbackMessage
15 | {
16 | /// Initializes a new instance of the class.
17 | /// The default file path of the JSON document.
18 | public SaveJsonDocumentMessage(string fileName)
19 | {
20 | FileName = fileName;
21 | }
22 |
23 | /// Gets or sets the file name.
24 | public string FileName { get; private set; }
25 | }
26 | }
--------------------------------------------------------------------------------
/src/VisualJsonEditor/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.34014
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace VisualJsonEditor.Properties
12 | {
13 |
14 |
15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
18 | {
19 |
20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
21 |
22 | public static Settings Default
23 | {
24 | get
25 | {
26 | return defaultInstance;
27 | }
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/VisualJsonEditor/Converters/IntegerConverter.cs:
--------------------------------------------------------------------------------
1 | //-----------------------------------------------------------------------
2 | //
3 | // Copyright (c) Rico Suter. All rights reserved.
4 | //
5 | // http://visualjsoneditor.codeplex.com/license
6 | // Rico Suter, mail@rsuter.com
7 | //-----------------------------------------------------------------------
8 |
9 | using System;
10 | using System.Globalization;
11 | using System.Windows.Data;
12 |
13 | namespace VisualJsonEditor.Converters
14 | {
15 | public class IntegerConverter : IValueConverter
16 | {
17 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
18 | {
19 | return value != null ? value.ToString() : null;
20 | }
21 |
22 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
23 | {
24 | try
25 | {
26 | return long.Parse(value.ToString());
27 | }
28 | catch
29 | {
30 | return default(long);
31 | }
32 | }
33 | }
34 | }
--------------------------------------------------------------------------------
/src/VisualJsonEditor/Converters/DateConverter.cs:
--------------------------------------------------------------------------------
1 | //-----------------------------------------------------------------------
2 | //
3 | // Copyright (c) Rico Suter. All rights reserved.
4 | //
5 | // http://visualjsoneditor.codeplex.com/license
6 | // Rico Suter, mail@rsuter.com
7 | //-----------------------------------------------------------------------
8 |
9 | using System;
10 | using System.Globalization;
11 | using System.Windows.Data;
12 |
13 | namespace VisualJsonEditor.Converters
14 | {
15 | public class DateConverter : IValueConverter
16 | {
17 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
18 | {
19 | if (value == null)
20 | return null;
21 |
22 | return value is DateTime ? value : DateTime.Parse(value.ToString());
23 | }
24 |
25 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
26 | {
27 | if (value is DateTime)
28 | {
29 | return ((DateTime)value).ToString("yyyy-MM-dd");
30 | }
31 | return null;
32 | }
33 | }
34 | }
--------------------------------------------------------------------------------
/src/VisualJsonEditor/Converters/TimeConverter.cs:
--------------------------------------------------------------------------------
1 | //-----------------------------------------------------------------------
2 | //
3 | // Copyright (c) Rico Suter. All rights reserved.
4 | //
5 | // http://visualjsoneditor.codeplex.com/license
6 | // Rico Suter, mail@rsuter.com
7 | //-----------------------------------------------------------------------
8 |
9 | using System;
10 | using System.Globalization;
11 | using System.Windows.Data;
12 |
13 | namespace VisualJsonEditor.Converters
14 | {
15 | public class TimeConverter : IValueConverter
16 | {
17 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
18 | {
19 | if (value == null)
20 | return null;
21 |
22 | return value is TimeSpan ?
23 | DateTime.MinValue + (TimeSpan)value :
24 | DateTime.MinValue + TimeSpan.Parse(value.ToString());
25 | }
26 |
27 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
28 | {
29 | if (value is DateTime)
30 | return ((DateTime)value).TimeOfDay;
31 |
32 | return value;
33 | }
34 | }
35 | }
--------------------------------------------------------------------------------
/src/VisualJsonEditor/Converters/IndexConverter.cs:
--------------------------------------------------------------------------------
1 | //-----------------------------------------------------------------------
2 | //
3 | // Copyright (c) Rico Suter. All rights reserved.
4 | //
5 | // http://visualjsoneditor.codeplex.com/license
6 | // Rico Suter, mail@rsuter.com
7 | //-----------------------------------------------------------------------
8 |
9 | using System;
10 | using System.Collections;
11 | using System.Globalization;
12 | using System.Windows.Data;
13 |
14 | namespace VisualJsonEditor.Converters
15 | {
16 | public class IndexConverter : IMultiValueConverter
17 | {
18 | public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
19 | {
20 | var list = (IList)values[1];
21 | if (list != null)
22 | {
23 | var index = list.IndexOf(values[0]) + 1;
24 | return targetType == typeof(string) ? index.ToString() : (object)index;
25 | }
26 | return null;
27 | }
28 |
29 | public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
30 | {
31 | throw new NotImplementedException();
32 | }
33 | }
34 | }
--------------------------------------------------------------------------------
/src/VisualJsonEditor/Converters/IntegerUpDownRangeConverter.cs:
--------------------------------------------------------------------------------
1 | //-----------------------------------------------------------------------
2 | //
3 | // Copyright (c) Rico Suter. All rights reserved.
4 | //
5 | // http://visualjsoneditor.codeplex.com/license
6 | // Rico Suter, mail@rsuter.com
7 | //-----------------------------------------------------------------------
8 |
9 | using System;
10 | using System.Globalization;
11 | using System.Windows.Data;
12 |
13 | namespace VisualJsonEditor.Converters
14 | {
15 | public class IntegerUpDownRangeConverter : IValueConverter
16 | {
17 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
18 | {
19 | if (value == null)
20 | return parameter.ToString() == "min" ? int.MinValue : int.MaxValue;
21 |
22 | if (value is decimal)
23 | return (int)(decimal)value;
24 | if (value is double)
25 | return (int)(double)value;
26 |
27 | return (int)value;
28 | }
29 |
30 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
31 | {
32 | return value;
33 | }
34 | }
35 | }
--------------------------------------------------------------------------------
/src/VisualJsonEditor/Views/AboutWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | //-----------------------------------------------------------------------
2 | //
3 | // Copyright (c) Rico Suter. All rights reserved.
4 | //
5 | // http://visualjsoneditor.codeplex.com/license
6 | // Rico Suter, mail@rsuter.com
7 | //-----------------------------------------------------------------------
8 |
9 | using System.Diagnostics;
10 | using System.Reflection;
11 | using System.Windows;
12 | using System.Windows.Documents;
13 | using MyToolkit.Utilities;
14 |
15 | namespace VisualJsonEditor.Views
16 | {
17 | /// Interaction logic for AboutWindow.xaml
18 | public partial class AboutWindow : Window
19 | {
20 | public AboutWindow()
21 | {
22 | InitializeComponent();
23 | Version.Text = "v" + Assembly.GetExecutingAssembly().GetVersionWithBuildTime();
24 | }
25 |
26 | private void OnOpenHyperlink(object sender, RoutedEventArgs e)
27 | {
28 | var uri = ((Hyperlink)sender).NavigateUri;
29 | Process.Start(uri.ToString());
30 | }
31 |
32 | private void OnClose(object sender, RoutedEventArgs e)
33 | {
34 | Close();
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/assets/FileIcon.metrop:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/src/VisualJsonEditor/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/assets/ApplicationIcon.metrop:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/src/VisualJsonEditor/Converters/NumberConverter.cs:
--------------------------------------------------------------------------------
1 | //-----------------------------------------------------------------------
2 | //
3 | // Copyright (c) Rico Suter. All rights reserved.
4 | //
5 | // http://visualjsoneditor.codeplex.com/license
6 | // Rico Suter, mail@rsuter.com
7 | //-----------------------------------------------------------------------
8 |
9 | using System;
10 | using System.Globalization;
11 | using System.Windows.Data;
12 |
13 | namespace VisualJsonEditor.Converters
14 | {
15 | public class NumberConverter : IValueConverter
16 | {
17 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
18 | {
19 | return value != null ? value.ToString() : null;
20 | }
21 |
22 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
23 | {
24 | if (targetType == typeof(decimal))
25 | {
26 | try
27 | {
28 | return decimal.Parse(value.ToString());
29 | }
30 | catch
31 | {
32 | return default(decimal);
33 | }
34 | }
35 | else
36 | {
37 | try
38 | {
39 | return double.Parse(value.ToString());
40 | }
41 | catch
42 | {
43 | return default(double);
44 | }
45 | }
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/src/VisualJsonEditor/Models/JsonTokenModel.cs:
--------------------------------------------------------------------------------
1 | //-----------------------------------------------------------------------
2 | //
3 | // Copyright (c) Rico Suter. All rights reserved.
4 | //
5 | // http://visualjsoneditor.codeplex.com/license
6 | // Rico Suter, mail@rsuter.com
7 | //-----------------------------------------------------------------------
8 |
9 | using System.Collections.ObjectModel;
10 | using MyToolkit.Collections;
11 | using Newtonsoft.Json;
12 | using Newtonsoft.Json.Linq;
13 | using NJsonSchema;
14 |
15 | namespace VisualJsonEditor.Models
16 | {
17 | /// Represents a JSON token which may be an object or a single value.
18 | public abstract class JsonTokenModel : ObservableDictionary
19 | {
20 | /// Gets or sets the schema of the token.
21 | public JsonSchema Schema { get; set; }
22 |
23 | /// Gets or sets the parent list if applicable (may be null).
24 | public ObservableCollection ParentList { get; set; }
25 |
26 | /// Converts the token to a JSON string.
27 | /// The JSON string.
28 | public string ToJson()
29 | {
30 | var token = ToJToken();
31 | return JsonConvert.SerializeObject(token, Formatting.Indented);
32 | }
33 |
34 | /// Converts the to a .
35 | /// The .
36 | public abstract JToken ToJToken();
37 | }
38 | }
--------------------------------------------------------------------------------
/src/VisualJsonEditor/ApplicationConfiguration.cs:
--------------------------------------------------------------------------------
1 | //-----------------------------------------------------------------------
2 | //
3 | // Copyright (c) Rico Suter. All rights reserved.
4 | //
5 | // http://visualjsoneditor.codeplex.com/license
6 | // Rico Suter, mail@rsuter.com
7 | //-----------------------------------------------------------------------
8 |
9 | using System.Collections.ObjectModel;
10 | using System.IO;
11 | using System.Windows;
12 | using Newtonsoft.Json;
13 |
14 | namespace VisualJsonEditor
15 | {
16 | /// Stores the application configuration.
17 | public class ApplicationConfiguration
18 | {
19 | public ApplicationConfiguration()
20 | {
21 | IsFirstStart = true;
22 |
23 | WindowHeight = 600;
24 | WindowWidth = 700;
25 | WindowState = WindowState.Normal;
26 |
27 | RecentFiles = new ObservableCollection();
28 | }
29 |
30 | public bool IsFirstStart { get; set; }
31 | public double WindowWidth { get; set; }
32 | public double WindowHeight { get; set; }
33 | public WindowState WindowState { get; set; }
34 | public ObservableCollection RecentFiles { get; set; }
35 | }
36 |
37 | /// Describes a recently opened file.
38 | public class RecentFile
39 | {
40 | /// Gets or sets the file path.
41 | public string FilePath { get; set; }
42 |
43 | [JsonIgnore]
44 | public string FileName { get { return Path.GetFileName(FilePath); } }
45 | }
46 | }
--------------------------------------------------------------------------------
/src/VisualJsonEditor/Models/JsonValueModel.cs:
--------------------------------------------------------------------------------
1 | //-----------------------------------------------------------------------
2 | //
3 | // Copyright (c) Rico Suter. All rights reserved.
4 | //
5 | // http://visualjsoneditor.codeplex.com/license
6 | // Rico Suter, mail@rsuter.com
7 | //-----------------------------------------------------------------------
8 |
9 | using Newtonsoft.Json.Linq;
10 | using NJsonSchema;
11 |
12 | namespace VisualJsonEditor.Models
13 | {
14 | /// Represents a single JSON value.
15 | public class JsonValueModel : JsonTokenModel
16 | {
17 | /// Initializes a new instance of the class.
18 | public JsonValueModel()
19 | {
20 | this["Value"] = null;
21 | }
22 |
23 | /// Creates a from a and a given schema.
24 | /// The value.
25 | /// The schema.
26 | /// The .
27 | public static JsonValueModel FromJson(JValue value, JsonSchema schema)
28 | {
29 | return new JsonValueModel
30 | {
31 | Schema = schema,
32 | Value = value.Value
33 | };
34 | }
35 |
36 | /// Gets or sets the value.
37 | public object Value
38 | {
39 | get { return ContainsKey("Value") ? this["Value"] : null; }
40 | set { this["Value"] = value; }
41 | }
42 |
43 | /// Converts the to a .
44 | /// The .
45 | public override JToken ToJToken()
46 | {
47 | return new JValue(Value);
48 | }
49 | }
50 | }
--------------------------------------------------------------------------------
/src/VisualJsonEditor/Samples/Sample.schema.json:
--------------------------------------------------------------------------------
1 | {
2 | "type": "object",
3 | "title": "Person",
4 | "required": [
5 | "StringValue",
6 | "BoolValue",
7 | "NumberValue",
8 | "DateTimeValue",
9 | "DateValue",
10 | "TimeValue",
11 | "IntegerValue",
12 | "Test",
13 | "List"
14 | ],
15 | "properties": {
16 | "StringValue": {
17 | "type": "string",
18 | "default": "n/a"
19 | },
20 | "StringValueFormatByte": {
21 | "type": "string",
22 | "format": "byte"
23 | },
24 | "BoolValue": {
25 | "type": "boolean"
26 | },
27 | "NumberValue": {
28 | "type": "number",
29 | "minimum": -1
30 | },
31 | "DateTimeValue": {
32 | "type": "string",
33 | "format": "date-time"
34 | },
35 | "DateValue": {
36 | "type": "string",
37 | "format": "date"
38 | },
39 | "TimeValue": {
40 | "type": "string",
41 | "format": "time"
42 | },
43 | "IntegerValue": {
44 | "type": "integer",
45 | "minimum": 0
46 | },
47 | "EnumValue": {
48 | "type": "string",
49 | "enum": [ "one", "two", "three" ],
50 | "x-enumNames": [ "One", "Two", "Three" ]
51 | },
52 | "Test": {
53 | "type": "object",
54 | "required": [
55 | "Abc",
56 | "Def",
57 | "Geh"
58 | ],
59 | "properties": {
60 | "Abc": {
61 | "type": "string"
62 | },
63 | "Def": {
64 | "type": "string"
65 | },
66 | "Geh": {
67 | "type": "string"
68 | }
69 | }
70 | },
71 | "List": {
72 | "type": "array",
73 | "items": {
74 | "type": "object",
75 | "properties": {
76 | "Abc": {
77 | "type": "string",
78 | "minLength": 1
79 | },
80 | "Def": {
81 | "type": "string"
82 | },
83 | "Geh": {
84 | "type": "string"
85 | }
86 | }
87 | }
88 | }
89 | }
90 | }
--------------------------------------------------------------------------------
/src/VisualJsonEditor.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 2013
4 | VisualStudioVersion = 12.0.31101.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VisualJsonEditor", "VisualJsonEditor\VisualJsonEditor.csproj", "{CA84EB04-87DC-4287-A7FB-56A0C61C06BA}"
7 | EndProject
8 | Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "VisualJsonEditor.Installer", "VisualJsonEditor.Installer\VisualJsonEditor.Installer.wixproj", "{16A1D263-97CA-421B-B03A-96BDEFE05F89}"
9 | EndProject
10 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{E4B6C387-F4A5-4DD1-B36F-97AB02D8A266}"
11 | ProjectSection(SolutionItems) = preProject
12 | .nuget\NuGet.Config = .nuget\NuGet.Config
13 | .nuget\NuGet.exe = .nuget\NuGet.exe
14 | .nuget\NuGet.targets = .nuget\NuGet.targets
15 | EndProjectSection
16 | EndProject
17 | Global
18 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
19 | Debug|Any CPU = Debug|Any CPU
20 | Debug|Mixed Platforms = Debug|Mixed Platforms
21 | Release|Any CPU = Release|Any CPU
22 | Release|Mixed Platforms = Release|Mixed Platforms
23 | EndGlobalSection
24 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
25 | {CA84EB04-87DC-4287-A7FB-56A0C61C06BA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
26 | {CA84EB04-87DC-4287-A7FB-56A0C61C06BA}.Debug|Any CPU.Build.0 = Debug|Any CPU
27 | {CA84EB04-87DC-4287-A7FB-56A0C61C06BA}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
28 | {CA84EB04-87DC-4287-A7FB-56A0C61C06BA}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
29 | {CA84EB04-87DC-4287-A7FB-56A0C61C06BA}.Release|Any CPU.ActiveCfg = Release|Any CPU
30 | {CA84EB04-87DC-4287-A7FB-56A0C61C06BA}.Release|Any CPU.Build.0 = Release|Any CPU
31 | {CA84EB04-87DC-4287-A7FB-56A0C61C06BA}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
32 | {CA84EB04-87DC-4287-A7FB-56A0C61C06BA}.Release|Mixed Platforms.Build.0 = Release|Any CPU
33 | {16A1D263-97CA-421B-B03A-96BDEFE05F89}.Debug|Any CPU.ActiveCfg = Debug|x86
34 | {16A1D263-97CA-421B-B03A-96BDEFE05F89}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
35 | {16A1D263-97CA-421B-B03A-96BDEFE05F89}.Debug|Mixed Platforms.Build.0 = Debug|x86
36 | {16A1D263-97CA-421B-B03A-96BDEFE05F89}.Release|Any CPU.ActiveCfg = Release|x86
37 | {16A1D263-97CA-421B-B03A-96BDEFE05F89}.Release|Any CPU.Build.0 = Release|x86
38 | {16A1D263-97CA-421B-B03A-96BDEFE05F89}.Release|Mixed Platforms.ActiveCfg = Release|x86
39 | {16A1D263-97CA-421B-B03A-96BDEFE05F89}.Release|Mixed Platforms.Build.0 = Release|x86
40 | EndGlobalSection
41 | GlobalSection(SolutionProperties) = preSolution
42 | HideSolutionNode = FALSE
43 | EndGlobalSection
44 | EndGlobal
45 |
--------------------------------------------------------------------------------
/src/VisualJsonEditor/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.34014
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace VisualJsonEditor.Properties
12 | {
13 |
14 |
15 | ///
16 | /// A strongly-typed resource class, for looking up localized strings, etc.
17 | ///
18 | // This class was auto-generated by the StronglyTypedResourceBuilder
19 | // class via a tool like ResGen or Visual Studio.
20 | // To add or remove a member, edit your .ResX file then rerun ResGen
21 | // with the /str option, or rebuild your VS project.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources
26 | {
27 |
28 | private static global::System.Resources.ResourceManager resourceMan;
29 |
30 | private static global::System.Globalization.CultureInfo resourceCulture;
31 |
32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
33 | internal Resources()
34 | {
35 | }
36 |
37 | ///
38 | /// Returns the cached ResourceManager instance used by this class.
39 | ///
40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
41 | internal static global::System.Resources.ResourceManager ResourceManager
42 | {
43 | get
44 | {
45 | if ((resourceMan == null))
46 | {
47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("VisualJsonEditor.Properties.Resources", typeof(Resources).Assembly);
48 | resourceMan = temp;
49 | }
50 | return resourceMan;
51 | }
52 | }
53 |
54 | ///
55 | /// Overrides the current thread's CurrentUICulture property for all
56 | /// resource lookups using this strongly typed resource class.
57 | ///
58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
59 | internal static global::System.Globalization.CultureInfo Culture
60 | {
61 | get
62 | {
63 | return resourceCulture;
64 | }
65 | set
66 | {
67 | resourceCulture = value;
68 | }
69 | }
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/src/VisualJsonEditor/Controls/ExpandingGroupBox.cs:
--------------------------------------------------------------------------------
1 | //-----------------------------------------------------------------------
2 | //
3 | // Copyright (c) Rico Suter. All rights reserved.
4 | //
5 | // http://visualjsoneditor.codeplex.com/license
6 | // Rico Suter, mail@rsuter.com
7 | //-----------------------------------------------------------------------
8 |
9 | using System.Windows;
10 | using System.Windows.Controls;
11 | using MyToolkit.Utilities;
12 |
13 | namespace VisualJsonEditor.Controls
14 | {
15 | /// A group box with expander.
16 | public class ExpandingGroupBox : ContentControl
17 | {
18 | static ExpandingGroupBox()
19 | {
20 | DefaultStyleKeyProperty.OverrideMetadata(typeof(ExpandingGroupBox), new FrameworkPropertyMetadata(typeof(ExpandingGroupBox)));
21 | }
22 |
23 | public static readonly DependencyProperty HeaderProperty = DependencyProperty.Register(
24 | "Header", typeof (object), typeof (ExpandingGroupBox), new PropertyMetadata(default(object)));
25 |
26 | /// Gets or sets the header object (data context of header template).
27 | public object Header
28 | {
29 | get { return (object) GetValue(HeaderProperty); }
30 | set { SetValue(HeaderProperty, value); }
31 | }
32 |
33 | public static readonly DependencyProperty HeaderTemplateProperty = DependencyProperty.Register(
34 | "HeaderTemplate", typeof (DataTemplate), typeof (ExpandingGroupBox), new PropertyMetadata(default(DataTemplate)));
35 |
36 | /// Gets or sets the header template (always visible).
37 | public DataTemplate HeaderTemplate
38 | {
39 | get { return (DataTemplate) GetValue(HeaderTemplateProperty); }
40 | set { SetValue(HeaderTemplateProperty, value); }
41 | }
42 |
43 | public static readonly DependencyProperty IsExpandedProperty = DependencyProperty.Register(
44 | "IsExpanded", typeof (bool), typeof (ExpandingGroupBox), new PropertyMetadata(true));
45 |
46 | /// Gets or sets a value indicating whether the group box is expanded.
47 | public bool IsExpanded
48 | {
49 | get { return (bool) GetValue(IsExpandedProperty); }
50 | set { SetValue(IsExpandedProperty, value); }
51 | }
52 |
53 | /// When overridden in a derived class, is invoked whenever application code or internal
54 | /// processes call .
55 | public override void OnApplyTemplate()
56 | {
57 | base.OnApplyTemplate();
58 |
59 | Loaded += delegate
60 | {
61 | var button = this.FindVisualChild