I have a problem getting the invoice number and invoice line number into a variable.
<script>
const emma = '<%=http2.ResponseText%>';
const obj = JSON.parse(emma);
console.log("object: %O", obj);
console.log(parameters["parameters"][1]["iInvoiceNum"]);
</script>
This is how the console displays. I just want to be able to pass the iInvoiceNum and iInvoiceLine into separate variables.

obj.parameters.ds.iInvoiceNum?obj.parametersand see what was returned, like already said you have the structure of the object already there for you to play with, dev tools are great for that sort of thing.