Transfondo:
I have an application in VB.NET where I consume some web services "API's". One of these APIs (for the purposes of the question will be called EnviarArchivo
) returns an object with this structure:
API response EnviarArchivo
:
[{
"DocumentType": "SalesInvoice",
"CreationDate": "2019-01-02T15:26:00.041Z",
"DocumentDate": "2018-10-17T00:00:00",
"DueDate": "2018-10-17T00:00:00.000Z",
"Currency": "COP",
"BusinessStatus": "Certified",
"CommunicationStatus": "DeliverOk",
"MainNotificationEmailStatus": "Delivered",
...
}]
I have a global variable called "translationRespuestasAPI" whose value is a JSON object with this structure:
Global variable traduccionRespuestasAPI
:
var traduccionRespuestasAPI = {
"Cancel": "Cancelar",
"Categories": "Categorias",
"Certified": "Certificado",
"CitizenshipCard": "Tarjeta Ciudadanía",
"Delireved": "Entregado",
"Delivered": "Entregado",
"DeliverOk": "Entrega Exitosa",
"Description_Label": "Descripción",
"Received": "Recibido",
"Registered": "Registrado",
"Reject": "Rechazar",
...
};
Problem:
What I'm looking for is that "according to the response of the API EnviarArchivo
" see the global variable traduccionRespuestasAPI
and set the value.
Example:
If the response of the API EnviarArchivo
in the field "BusinessStatus" was "Certified", you should search the global variable traduccionRespuestasAPI
the attribute with name "Certified" and show the value "Certificate".
Without using loops, how to access the value of the local variable according to the response of the API?