JsonFile ClassDelta Engine Documentation
Allows json files to be loaded from disk by utilizing the JsonNode parser. View code on GitHub
Inheritance Hierarchy

System Object
  DeltaEngine.Content.Json JsonFile

Namespace: DeltaEngine.Content.Json
Assembly: DeltaEngine.Content.Json (in DeltaEngine.Content.Json.dll) Version: 1.1.1.0 (1.1.1)
Syntax

public class JsonFile

The JsonFile type exposes the following members.

Constructors

  NameDescription
Public methodJsonFile
Initializes a new instance of the JsonFile class
Top
Properties

  NameDescription
Public propertyRoot
Top
Remarks

Tests: DeltaEngine.Content.Json.Tests.JsonFileTests
Examples

4 unit tests call DeltaEngine.Content.Json.JsonFile
[Test]
public void LoadNodeFromTestJson()
{
    var file = new JsonFile(TestFilename);
    Assert.AreEqual(6, file.Root.Get<int>("SomeData"));
}
[Test]
public void TestJsonHasOneNode()
{
    var file = new JsonFile(TestFilename);
    Assert.AreEqual(1, file.Root.NumberOfNodes);
}
[Test]
public void LoadingJsonWithoutFileIsNotAllowed()
{
    Assert.Throws<JsonFile.FileNotFound>(() => new JsonFile(null));
    Assert.Throws<JsonFile.FileNotFound>(() => new JsonFile(""));
}
See Also