// Read one of these types. // NB: Although JsonKit.JsonParseInto only works on reference type, when using reflection // it also works for value types so we use the one method for both public void ParseInto(IJsonReader r, object into) { var loading = into as IJsonLoading; if (loading != null) { loading.OnJsonLoading(r); } r.ParseDictionary(key => { ParseFieldOrProperty(r, into, key); }); var loaded = into as IJsonLoaded; if (loaded != null) { loaded.OnJsonLoaded(r); } }
/// <summary> /// Reads a dictionary from the input stream /// </summary> /// <param name="reader">The IJsonReader instance</param> /// <param name="callback">A callback that will be invoked for each encountered dictionary key</param> public static void ParseDictionary <T>(this IJsonReader reader, Action <T> callback) { reader.ParseDictionary(typeof(T), (o) => callback((T)o)); }
/// <summary> /// Reads a dictionary from the input stream /// </summary> /// <param name="reader">The IJsonReader instance</param> /// <param name="callback">A callback that will be invoked for each encountered dictionary key</param> public static void ParseDictionary(this IJsonReader reader, Action <string> callback) { reader.ParseDictionary <string>(callback); }