Doing a loop over this json, I always need to be able to get this value "8047" from "value_name":"https://www.portalinmobiliario.com/venta/departamento/estacion-central-metropolitana/8047-edificio-caiquen-nva"
that you can see in the json,this is kind of big so it is easier if you use ctrl + F and look for it, but I put the complete json so you can have a good reference of the way to the variable I actually need to get.
"results":[
{
"id":283495,
"user":{
"id":204841198,
"nickname":"RICARDOCAMPOSANO",
"registration_date":"2016-02-01T15:18:01Z",
"first_name":"Ricardo",
"last_name":"Camposano",
"country_id":"CL",
"email":"ricardo.camposano26@gmail.com",
"phone":{},
"alternative_phone":{},
"identification":{},
"user_type":"normal",
"tags":[],
"points":0,
"site_id":"MLC",
"permalink":"http://perfil.mercadolibre.cl/RICARDOCAMPOSANO",
"secure_email":"rcampos.l4jn3q@mail.mercadolibre.cl"
},
"item":{
"id":"MLC462815278",
"site_id":"MLC",
"title":"Edificio Caiquén",
"subtitle":"",
"seller_id":330106543,
"category_id":"MLC157523",
"domain_id":"MLC-DEVELOPMENT_APARTMENTS_FOR_SALE",
"price":1885,
"base_price":1885,
"original_price":0,
"currency_id":"CLF",
"price_conversions":[],
"initial_quantity":330,
"available_quantity":330,
"sold_quantity":0,
"buying_mode":"classified",
"listing_type_id":"silver",
"start_time":"2018-07-12T18:50:09Z",
"stop_time":"2018-08-13T04:00:00Z",
"condition":"new",
"permalink":"http://departamento.mercadolibre.cl/MLC-462815278-edificio-caiquen-_JM",
"thumbnail":"http://www.mercadolibre.com/jm/img?s=STC\u0026v=I\u0026f=processing_image_es.jpg",
"secure_thumbnail":"https://www.mercadolibre.com/jm/img?s=STC\u0026v=I\u0026f=processing_image_es.jpg",
"pictures":[],
"video_id":"",
"descriptions":[],
"seller_address":{},
"seller_contact":{},
"location":{},
"attributes":[
{
"id":"ITEM_CONDITION",
"name":"Condición del ítem",
"value_id":"2230284",
"value_name":"Nuevo"
},
{
"id":"DOWN_PAYMENT",
"name":"Pie",
"value_id":"",
"value_name":"10 %"
},
{
"id":"RESERVATION_FEE",
"name":"Monto reserva",
"value_id":"",
"value_name":"0 UF"
},
{
"id":"CMG_SITE",
"name":"Sitio de origen",
"value_id":"",
"value_name":"POI"
},
{
"id":"CANONICAL_URL",
"name":"Url canónica",
"value_id":"",
"value_name":"https://www.portalinmobiliario.com/venta/departamento/estacion-central-metropolitana/8047-edificio-caiquen-nva"
},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{}
],
"variations":null,
"listing_source":"portalinmobiliario",
"status":"active",
"tags":[
],
"parent_item_id":"",
"automatic_relist":false,
"date_created":"2018-07-12T18:50:17Z",
"last_updated":"2018-07-12T18:50:17Z"
},
"variation":{},
"created_at":"2018-07-12T18:50:22Z",
"is_guest":false
}
]
}
In javascript I can achieve this by doing:
var id = id_proyecto = valor.item.attributes[4].value_name.match(/\/(\d+)-[^/]+$/)[1];
But I have no idea how to do it in c#. I think is actually more complex.
Any clue how to figure this out?