diff --git a/nanoFramework.Json/JsonArray.cs b/nanoFramework.Json/JsonArray.cs
index 593dcf1..75ff990 100644
--- a/nanoFramework.Json/JsonArray.cs
+++ b/nanoFramework.Json/JsonArray.cs
@@ -6,19 +6,28 @@
namespace nanoFramework.Json
{
- internal class JsonArray : JsonToken
+ ///
+ /// Represents array of objects from JSON string.
+ ///
+ public sealed class JsonArray : JsonToken
{
- public JsonArray()
- {
- }
-
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// Initial array.
public JsonArray(JsonToken[] values)
{
Items = values;
}
-
+
+ ///
+ /// Gets the lenght of array.
+ ///
public int Length => Items.Length;
+ ///
+ /// Gets collection of .
+ ///
public JsonToken[] Items { get; }
}
}
diff --git a/nanoFramework.Json/JsonObject.cs b/nanoFramework.Json/JsonObject.cs
index 28e65e7..acdd27a 100644
--- a/nanoFramework.Json/JsonObject.cs
+++ b/nanoFramework.Json/JsonObject.cs
@@ -8,15 +8,36 @@
namespace nanoFramework.Json
{
- internal class JsonObject : JsonToken
+ ///
+ /// Represents single JSON object that contains multiple JSON properties.
+ ///
+ public sealed class JsonObject : JsonToken
{
private readonly Hashtable _members = new();
+ ///
+ /// Gets the collection of values from .
+ ///
public ICollection Members => _members.Values;
+ ///
+ /// Adds new key value pair to collection.
+ ///
+ /// JSON property key.
+ /// JSON property value.
public void Add(string name, JsonToken value)
{
- _members.Add(name.ToLower(), new JsonProperty(name, value));
+ _members.Add(name, new JsonProperty(name, value));
+ }
+
+ ///
+ /// Gets the value of property for given key.
+ ///
+ /// JSON property key.
+ /// JsonProperty object which contains key and value of object.
+ public JsonProperty Get(string name)
+ {
+ return (JsonProperty)_members[name];
}
}
}
diff --git a/nanoFramework.Json/JsonProperty.cs b/nanoFramework.Json/JsonProperty.cs
index 5638066..7872906 100644
--- a/nanoFramework.Json/JsonProperty.cs
+++ b/nanoFramework.Json/JsonProperty.cs
@@ -6,19 +6,30 @@
namespace nanoFramework.Json
{
- internal class JsonProperty : JsonToken
+ ///
+ /// Represents single JSON key value pair.
+ ///
+ public sealed class JsonProperty : JsonToken
{
- public JsonProperty()
- {
- }
-
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// JSON property key.
+ /// JSON property value.
public JsonProperty(string name, JsonToken value)
{
Name = name;
Value = value;
}
- public string Name { get; set; }
- public JsonToken Value { get; set; }
+ ///
+ /// Gets key of JSON property.
+ ///
+ public string Name { get; }
+
+ ///
+ /// Gets value of Json property.
+ ///
+ public JsonToken Value { get; }
}
}
diff --git a/nanoFramework.Json/JsonToken.cs b/nanoFramework.Json/JsonToken.cs
index 17b217f..03922da 100644
--- a/nanoFramework.Json/JsonToken.cs
+++ b/nanoFramework.Json/JsonToken.cs
@@ -8,42 +8,11 @@
namespace nanoFramework.Json
{
- internal abstract class JsonToken
+ ///
+ /// Base class for all Json structures.
+ ///
+ public abstract class JsonToken
{
- public static string ConvertToString(byte[] byteArray, int start, int count)
- {
- var _chars = new char[byteArray.Length];
-
- Encoding.UTF8.GetDecoder().Convert(
- byteArray,
- start,
- count,
- _chars,
- 0,
- byteArray.Length,
- false,
- out _,
- out int _charsUsed,
- out _);
-
- return new string(_chars, 0, _charsUsed);
- }
-
- public static int FindNul(byte[] buffer, int start)
- {
- int current = start;
-
- while (current < buffer.Length)
- {
- if (buffer[current++] != 0)
- {
- continue;
- }
-
- return current - 1;
- }
-
- return -1;
- }
+
}
}
diff --git a/nanoFramework.Json/JsonValue.cs b/nanoFramework.Json/JsonValue.cs
index e9d301d..6cb4efd 100644
--- a/nanoFramework.Json/JsonValue.cs
+++ b/nanoFramework.Json/JsonValue.cs
@@ -8,12 +8,17 @@
namespace nanoFramework.Json
{
- internal class JsonValue : JsonToken
+ ///
+ /// Represents single object from JSON string.
+ ///
+ public sealed class JsonValue : JsonToken
{
- public JsonValue()
- {
- }
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// Value of current JSON object.
+ /// Is the type of value DateTime.
public JsonValue(object value, bool isDateTime = false)
{
if (isDateTime)
@@ -29,6 +34,9 @@ public JsonValue(object value, bool isDateTime = false)
}
}
- public object Value { get; set; }
+ ///
+ /// Gets or sets object value.
+ ///
+ public object Value { get; }
}
}