internal static Message[] FromArray(Dictionary <string, object?>?data, string field) { var array = TinyJsonParser.GetArrayField(data, field); var res = new Message[array.Count]; for (int i = 0; i < res.Length; i++) { var obj = (Dictionary <string, object?>?)array[i]; (var key, var value) = TinyJsonParser.GetStringPair(obj, "name", "description"); res[i] = new Message(key !, value !); } return(res); }
internal static Message From(Dictionary <string, object?>?data, string field) { (var key, var value) = TinyJsonParser.GetStringPair(TinyJsonParser.GetMapField(data, field), "name", "description"); return(new Message(key ?? string.Empty, value ?? string.Empty)); }
internal static Message From(Dictionary <string, object> data, string field) { var kvp = TinyJsonParser.GetStringPair(TinyJsonParser.GetMapField(data, field), "name", "description"); return(new Message(kvp.Key ?? String.Empty, kvp.Value ?? String.Empty)); }