sasalka/Code/SimpleJson.cs
2025-06-26 01:56:08 +03:00

24 lines
441 B
C#

using System.Text.Json;
namespace Sasalka;
public static class SimpleJson
{
public static string[] ParseClothingTitles( string json )
{
using var doc = JsonDocument.Parse( json );
var root = doc.RootElement;
var list = new List<string>();
foreach ( var elem in root.EnumerateArray() )
{
if ( elem.TryGetProperty( "Title", out var title ) )
{
list.Add( title.GetString() );
}
}
return list.ToArray();
}
}