{
"message": "Request Completed Successfully",
"code": 200,
"data": [{
"Year": {
"originalValue": "2017",
"displayValue": "2017",
"label": "Year"
},
“Transaction”: {
"originalValue": 7049542752.056771,
"displayValue": "704.95 Crores",
"label": "Total Value"
}
}]
}
The above is json response obtained after i make an external call to a service, when i parse the json to get the value originalValue, the value 7049542752.056771 changes to exponential value 7.049542752056771E9 , i want to do value comparison, but i am not able to do comparison correctly as the values are in exponential format.
How can I get the actual value same as the json values?
Following is the code i used for json parsing:
$$user_agent = ^“[email protected] User-Agent: Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; WOW64; Trident/6.0)”
$$header = ^” ~Accept: application/json “
$$tmp = ^jsonopen(transient POST $dataAPI $_json $$header $$user_agent)
$_cnt = ^length($$tmp.data)
$_index = 0
$originalValue = 0
^loop($_cnt) {
$salesValue = jsonpath(.data.$_index.Transaction.displayValue ^jsonparse($$tmp))
$originalValue = jsonpath(.data.$_index.Transaction.originalValue ^jsonparse($$tmp))
$_index += 1
}
Please review the code.