guru
guru

Reputation: 11

How to get integer value in json without double quotes?

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?

enter image description here

Upvotes: 1

Views: 329

Answers (1)

vadivel a
vadivel a

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

Related Questions