using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization.Formatters;
using System.ComponentModel.DataAnnotations;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Serialization;
public string Known { get; set; }
public string Word { get; set; }
public static void Test()
public static void TestWildcard()
var responseString = GetJson();
var root = JToken.Parse(responseString);
var searchTermList = root.SelectTokens("myTerms[*].Term")
.Select(t => t.ToObject<Term>())
Console.WriteLine("\nWildcard search result: ");
Console.WriteLine(JsonConvert.SerializeObject(searchTermList, Formatting.Indented));
public static void TestRecursiveDescent()
var responseString = GetJson();
var root = JToken.Parse(responseString);
var searchTermList = root.SelectTokens("..Term")
.Select(t => t.ToObject<Term>())
Console.WriteLine("\nRecursive descent search result: ");
Console.WriteLine(JsonConvert.SerializeObject(searchTermList, Formatting.Indented));
public static void Main()
Console.WriteLine("Environment version: " + Environment.Version);
Console.WriteLine("Json.NET version: " + typeof(JsonSerializer).Assembly.FullName);
Console.WriteLine("Failed with unhandled exception: ");
public class AssertionFailedException : System.Exception
public AssertionFailedException() : base() { }
public AssertionFailedException(string s) : base(s) { }
public static class Assert
public static void IsTrue(bool value)
public static void IsTrue(bool value, string message)
throw new AssertionFailedException(message ?? "failed");