-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
- Loading branch information
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Changelog | ||
All notable changes to this package will be documented in this file. | ||
|
||
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) | ||
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). | ||
|
||
## [Unreleased] | ||
|
||
### Added | ||
|
||
- JsonConverter for UnityEngine.Color | ||
- JsonConverter for System.URI |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# JSON Extra's for Netherlands3D | ||
|
||
## Installing | ||
|
||
This package is provided through OpenUPM, to install it using the CLI you can perform the following: | ||
|
||
```bash | ||
$ openupm add eu.netherlands3d.json | ||
``` | ||
|
||
or, you have to add `https://package.openupm.com` as a scoped registry with, at least, the following scopes: | ||
|
||
- `eu.netherlands3d` | ||
|
||
## JSON Converters | ||
|
||
## Color | ||
|
||
A JSON Converter for JSON.net is provided that can interpret hexadecimal or CSS-named color codes in JSON, and convert | ||
them into UnityEngine.Color objects. To use this, ensure the type of a field is UnityEngine.Color and add the following | ||
annotation: | ||
|
||
```csharp | ||
using UnityEngine; | ||
using Netherlands3D.Json.JsonConverters; | ||
using Newtonsoft.Json; | ||
|
||
class MyJson { | ||
[JsonConverter(typeof(ColorConverter))] | ||
public Color $color; | ||
} | ||
``` | ||
|
||
Accepted color variants are every variant supported by [ColorUtility.TryParseHtmlString](https://docs.unity3d.com/ScriptReference/ColorUtility.TryParseHtmlString.html). | ||
When serializing to a JSON file, it will always output as `#RRGGBBAA`. | ||
|
||
## System.URI | ||
|
||
A JSON Converter for JSON.net is provided that can interpret URIs in JSON and convert them into URI objects. To use | ||
this, ensure the type of a field is System.URI and add the following annotation: | ||
|
||
```csharp | ||
using System; | ||
using Netherlands3D.Json.JsonConverters; | ||
using Newtonsoft.Json; | ||
|
||
class MyJson { | ||
[JsonConverter(typeof(UriConverter))] | ||
public Uri $uri; | ||
} | ||
``` |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"name": "eu.netherlands3d.json.Runtime", | ||
"rootNamespace": "Netherlands3D.Json", | ||
"references": [], | ||
"includePlatforms": [], | ||
"excludePlatforms": [], | ||
"allowUnsafeCode": false, | ||
"overrideReferences": false, | ||
"precompiledReferences": [], | ||
"autoReferenced": true, | ||
"defineConstraints": [], | ||
"versionDefines": [], | ||
"noEngineReferences": false | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"name": "eu.netherlands3d.json", | ||
"version": "1.0.0", | ||
"displayName": "Netherlands3D - JSON Extras", | ||
"description": "A series of extras for working with JSON in the context of Netherlands3D", | ||
"unity": "2022.2", | ||
"documentationUrl": "https://netherlands3d.eu/docs", | ||
"changelogUrl": "https://example.com/changelog.html", | ||
"licensesUrl": "https://example.com/licensing.html", | ||
"keywords": [ | ||
"digital-twin", | ||
"json.net", | ||
"newtonsoft", | ||
"json" | ||
], | ||
"author": { | ||
"name": "Netherlands3D", | ||
"url": "https://www.netherlands3d.eu" | ||
}, | ||
"dependencies": { | ||
"com.unity.nuget.newtonsoft-json": "3.2.0" | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.