Формат один:
Код: Выделить всё
name: Tomato Chutney Three Ways
description: Tomato Chutney in three ways: Spicy Tomato Garlic Chutney, Sweet Tomato Chutney, and Oil-Free No-Cook Tomato Chutney.
cooking_instruction: |
For the Spicy Garlic Tomato Chutney:
- Heat 2 tbsp of oil in a pan.
- Serve with idli, dosas, and parathas.
For the Sweet Tomato Chutney:
- Heat 2 tbsp of oil, add asafoetida, fennel seeds, nigella seeds, dried red chilies, tomatoes, and salt. Cook for 5-7 minutes.
For the Oil-Free & No-Cook Tomato Chutney:
- Soak dried red chillies in white vinegar for 30 minutes.
Код: Выделить всё
name: Chicken Tikka Caesar Salad
description: Chicken Tikka Caesar Salad with romaine lettuce, bread croutons, and a flavorful dressing.
cooking_instruction:
- Take a bowl and combine hung curd, red chili powder, turmeric powder, coriander powder, garam masala, salt, ginger garlic paste, and chicken. Marinate for 15-20 minutes.
- Fry the marinated chicken in a grill pan with oil until crisp and golden brown.
Код: Выделить всё
name: Crispy Pata Pork Recipe (Deep Fried Pork Hock)
description: An easy deep fried pork recipe from the Philippines that is sure to win hearts over. What other pork recipes do you want to see?
cooking_instruction: |
- Boil everything except for the hock and the baking soda.
- Bring the liquid to a simmer, add in the hock with the lid on.
Код: Выделить всё
public class RecipeDto
{
public string Name { get; set; }
public string Description { get; set; }
public string CookingInstruction { get; set; }
}
Код: Выделить всё
var deserializer = new DeserializerBuilder()
.WithNamingConvention(UnderscoredNamingConvention.Instance)
.Build();
var recipeDto = deserializer.Deserialize(yamlData);
Код: Выделить всё
No node deserializer was able to deserialize the node into type System.String, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e
Правильно ли это обрабатывать десериализацию поля, которое может быть скаляром или последовательностью? Есть ли лучший подход или какие-либо улучшения этого решения?
Подробнее здесь: https://stackoverflow.com/questions/786 ... -scalar-or