thunderclient / thunder-client-support

Thunder Client is a lightweight Rest API Client Extension for VS Code.
https://www.thunderclient.com
Other
3.59k stars 128 forks source link

Json doubles ending in `.0` are parsed weirdly - Chart view #1518

Closed FMorschel closed 3 months ago

FMorschel commented 3 months ago

Describe the bug I have a response for my data:

Response ``` { "data": [ { "ordem": 48685, "valor_total": 702800.0, }, { "ordem": 48768, "valor_total": 0.0, }, { "ordem": 48769, "valor_total": 50710.0, }, { "ordem": 48774, "valor_total": 269.7, }, { "ordem": 48781, "valor_total": 206.7, }, { "ordem": 48782, "valor_total": 0.0, } ] } ```

And inside my chart view table, I can't show the second value because it displays as:

Weird show of double inside html

I tested by showing the full data and the following appeared:

chart_data ``` [ { "ordem": 48685, "valor_total": { "numberStr": "702800.0" } }, { "ordem": 48768, "valor_total": { "numberStr": "0.0" } }, { "ordem": 48769, "valor_total": { "numberStr": "50710.0" } }, { "ordem": 48774, "valor_total": 269.7 }, { "ordem": 48781, "valor_total": 206.7 }, { "ordem": 48782, "valor_total": { "numberStr": "0.0" } } ] ```

To Reproduce

Expected behavior I expect double values to be parsed right (really weird because integers parse with no problems as well and js has no differentiation)

Platform:

Are you using the free version/paid version/trial: Free version.

rangav commented 3 months ago

Hi @FMorschel, thanks for reporting, Will fix it ASAP.

rangav commented 3 months ago

Alternatively you can use this code

var response = JSON.parse(tc.response.text);
var html = `html code`;

tc.chartHTML(html, response.data);
FMorschel commented 3 months ago

Tested it and it worked, thanks for the workaround.

rangav commented 3 months ago

This bug is fixed, Please update extension to v2.21.4