.. | ||
Editor | ||
Scripts | ||
Editor.meta | ||
LICENSE | ||
LICENSE.meta | ||
README.md | ||
README.md.meta | ||
Scripts.meta |
UniJSON
JSON serializer and deserializer and schema utilities for Unity(.Net3.5)
JSON
JSON Schema
JSON Patch
ToDo
- anyOf to enum
- string.pattern
- enum.values
- array.items
- object.required
- object.dependencies
- object.additionalProperties
- default value
Example
[Serializable]
public class glTFSparseIndices
{
[JsonSchema(Minimum = 0)]
public int bufferView;
[JsonSchema(Minimum = 0)]
public int byteOffset;
[JsonSchema(EnumSerializationType = EnumSerializationType.AsInt)]
public glComponentType componentType;
// empty schemas
public object extensions;
public object extras;
}
[Test]
public void AccessorSparseIndices()
{
// from JSON schema
var path = Path.GetFullPath(Application.dataPath + "/../glTF/specification/2.0/schema");
var SchemaDir = new FileSystemAccessor(path);
var fromSchema = JsonSchema.ParseFromPath(SchemaDir.Get("accessor.sparse.indices.schema.json"));
// from C# type definition
var fromClass = JsonSchema.FromType<glTFSparseIndices>();
Assert.AreEqual(fromSchema, fromClass);
}