Reputation: 11
I am getting an integer value and I store it in a variable, but I am getting this value with quotes inside the json.. can anyone tell me how to get the integer value without the quotes inside the json?
Upvotes: 1
Views: 329
Reputation: 1794
I have used with a sample datas. Hope this will help you. Here is an example in
var array = '{ "char": "ten", "number": "10" }';
var returnvalue = JSON.parse(array);
var numbervalue = parseInt(returnvalue['number']);
jQuery('#result').html(numbervalue);
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div id="result"></div>
Upvotes: 1