Extract Json fields

Hello,

I have a json and I need to extract the fields to a variable.

Json

image

Fields: nome, nascimento, ni extract with var.SelectToken(“nome”)

after the field “situacao” I can’t extract it in the same way. something I’m forgetting, can anyone help?

Hi @KMota,

The key “situacao” itself consists of another Jobject and that is the reason you are not able to extract the values as string.

You can do a check with if condition where you check if the key is “situacao” then fetch “codigo” and “descricao” or also go directly into

var("nome")("situacao")("codigo").ToString (this will fetch you "0")
var("nome")("situacao")("descricao").ToString (this will fetch you "Regular")

This is the only video you need to understand Json objects : Learn JSON in 10 Minutes - YouTube

perfect. tnks :slight_smile:

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.