What happens is that I have a requirement, I have a Json but I need to capture the value, but I have to do it without using a Model, I have seen examples but they all manage models.
Is it possible to deserialize without a model?
At the moment I'm doing it like this:
Step 1:
I create the Json from PostMan
{
"CAMPO_EN_LA_TABLA": "valor que quiero capturar"
}
Step 2:
Create a Private model in the class, to be able to serialize:
private class Parametros
{
[Key]
public int Empid { get; set; }
public string Codigo { get; set; }
[Column(TypeName = "sql_variant")]
public object Valor { get; set; }
}
Step 3:
I deserialize it in a Dictionary:
var listParametros = JsonConvert.DeserializeObject<Parametros>(valor.ToString());
Step 4:
And the last thing is to capture the value and save it in some parameter:
object ValorCapturado = listParametros.Valor;
Console.WriteLine("Este es el valor impreso: " + listParametros.Valor);
As you can see I know how to deserialize, but in the requirements they ask me to do it without the Model, but I do not know how to map it like this