Convert Json to a Long type

1

I have a Json object coming from the localStorage and I need it to be converted to a Long type, in the case entidadeId

idEntidade = localStorage.getItem("idEntidade");
var entidadeId = JSON.parse(idEntidade);
    
asked by anonymous 13.10.2017 / 21:41

1 answer

4

As JavaScript is not a strongly typed language, I suggest you just convert your number to a number, as follows:

idEntidade = Number(localStorage.getItem("idEntidade"));
    
13.10.2017 / 21:48