How to parse JSON string with JS to eliminate or add characters

Viewed 20

This problem seeks to find an answer for a specific instance of a general problem, how to parse characters in JSON string. I am working on parsing through a JSON object to get value. The problem I am running into is that I cannot find a method for editing this variable further.

let asset_amount = asset_value[0]["amount"]
let print_final_value = JSON.stringify(asset_amount)

[Out]
91746004

For example, how would cut off the last two numbers to print 917460 or how could I add a decimal value, such that 917460.04. Another possibility I considered was converting the number to an integer or float variable.

I've read through the JSON.stringify docs, but they focus exclusively on whole values stored as string in key:value pairs. So, I am unsure how to format the object to get the value that it should represent. Thanks in advance - I'd sincerely appreciate any help or advice.

0 Answers
Related