Permalink
Browse files

INCR to v3.93 + add JsonObject.Child as an alias for GetUnescaped

  • Loading branch information...
mythz committed Jul 30, 2012
1 parent c1949f2 commit 5903b3c40dc0f6bf30f24c0d72a50745b6592ddb
@@ -3,7 +3,7 @@
<metadata xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<id>ServiceStack.Text</id>
<title>.NET's fastest JSON Serializer by ServiceStack</title>
- <version>3.9.2</version>
+ <version>3.9.3</version>
<authors>Demis Bellot</authors>
<owners>Demis Bellot</owners>
<summary>.NET's fastest JSON, JSV and CSV Text Serializers (3x faster than JSON.NET)</summary>
@@ -23,7 +23,7 @@ static Env()
+ (IsMonoTouch ? " MonoTouch" : "");
}
- public static decimal ServiceStackVersion = 3.92m;
+ public static decimal ServiceStackVersion = 3.93m;
public static bool IsUnix { get; set; }
@@ -11,13 +11,19 @@ public static T JsonTo<T>(this Dictionary<string, string> map, string key)
return Get<T>(map, key);
}
- public static T Get<T>(this Dictionary<string, string> map, string key)
+ /// <summary>
+ /// Get JSON string value converted to T
+ /// </summary>
+ public static T Get<T>(this Dictionary<string, string> map, string key)
{
string strVal;
return map.TryGetValue(key, out strVal) ? JsonSerializer.DeserializeFromString<T>(strVal) : default(T);
}
- public static string Get(this Dictionary<string, string> map, string key)
+ /// <summary>
+ /// Get JSON string value
+ /// </summary>
+ public static string Get(this Dictionary<string, string> map, string key)
{
string strVal;
return map.TryGetValue(key, out strVal) ? JsonTypeSerializer.Instance.UnescapeString(strVal) : null;
@@ -57,6 +63,9 @@ public static T ConvertTo<T>(this JsonObject jsonObject, Func<JsonObject, T> con
public class JsonObject : Dictionary<string, string>
{
+ /// <summary>
+ /// Get JSON string value
+ /// </summary>
public string this[string key]
{
get { return this.Get(key); }
@@ -84,11 +93,22 @@ public JsonObject Object(string propertyName)
: null;
}
- public string GetUnescaped(string key)
- {
- return base[key];
- }
- }
+ /// <summary>
+ /// Get unescaped string value
+ /// </summary>
+ public string GetUnescaped(string key)
+ {
+ return base[key];
+ }
+
+ /// <summary>
+ /// Get unescaped string value
+ /// </summary>
+ public string Child(string key)
+ {
+ return base[key];
+ }
+ }
public class JsonArrayObjects : List<JsonObject>
{
@@ -31,5 +31,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("3.9.0.0")]
+[assembly: AssemblyVersion("3.9.3.0")]
//[assembly: AssemblyFileVersion("1.0.0.0")]
@@ -103,8 +103,8 @@ public void Can_Parse_Discussion_using_JsonObject()
public void Can_Parse_Discussion_using_only_NET_collection_classes()
{
var jsonObj = JsonSerializer.DeserializeFromString<List<JsonObject>>(JsonGitResponse);
- var jsonPulls = JsonSerializer.DeserializeFromString<List<JsonObject>>(jsonObj[0]["pulls"]);
- var discussions = JsonSerializer.DeserializeFromString<List<JsonObject>>(jsonPulls[0]["discussion"])
+ var jsonPulls = JsonSerializer.DeserializeFromString<List<JsonObject>>(jsonObj[0].Child("pulls"));
+ var discussions = JsonSerializer.DeserializeFromString<List<JsonObject>>(jsonPulls[0].Child("discussion"))
.ConvertAll(x => new Discussion
{
Type = x.Get("type"),

0 comments on commit 5903b3c

Please sign in to comment.