mardi 14 mars 2017

How do i dynamically iterate through a nested JSON and update all the values that are floating type

I am trying to do something like the below:

Round off all the values of a huge nested response and round off any values that are floating points to two decimal places. I am trying to recursively call the function but i guess the real problem is how do i update the original JSON object and return it finally once i am done changing all the values. Once i am in the recursion function, i would have lost the sense of how deep i am into the Nested structure so i really wont know where to update the original

Aucun commentaire:

Enregistrer un commentaire