Get value of a Json in node.js [closed]

0

I find myself stuck and I hope you can help me. I have an API where I make my requests (Post, Get, Delete, etc.)

In this function I do a post sending a json, the answer is another json, as seen below.

With that all goes well, however I do not have the slightest idea of how to capture a specific value of the returned json, in the previous images I try to capture the VAT, but in the two ways I try to do it ( body.iva , body[0]['iva'] ) I leave indefinitely, obviously the catches are wrongly formulated, and it is at that point that I want them to guide me

    
asked by LuisAlava 01.10.2018 в 21:18
source

1 answer

1

I think fellow that what is missing is to return to the incoming string in a json. you can try this

var myJson = JSON.parse(body);
console.log("mi variable: "+myJson["iva"]);

greetings and good energy:)

    
answered by 01.10.2018 / 21:21
source