Quantcast
Channel: SCN : All Content - SAPUI5 Developer Center
Viewing all articles
Browse latest Browse all 6178

Read JSON Object

$
0
0

HI all,

 

I need to read the file in which the data is in JSON format but i need remove the spaces and newlines from the uploaded file.

 

Please suggest the required.

 

The following is the code snippet

 

               var r = new FileReader(); 

                    r.onload = function(e)

                    { 

                    var fileContent = e.target.result;

                    var val=fileContent.replace(/ /g,"");

                       }

 

 

File format

 

[{"country": "Nepal",

"value": 260

},

 

 

      {"country": "Bhutan","value": 700}]

 

 

Thanks

mano


Viewing all articles
Browse latest Browse all 6178

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>