JSON Convert all values to UPPERCASE

You are Here:

JSON Convert all values to UPPERCASE

There is no inbuilt method in javascript to convert all values to UPPERCASE. In this case, you have to use some logic to convert all values to UPPERCASE.

The following example will demonstrate how to convert all values to UPPERCASE.

Example

HTML Editor
<!DOCTYPE html> <html lang="en-US"> <body> <h1>JSON Convert all values to UPPERCASE</h1> <button onclick="myFunction()">Click Me</button> <script> var data = [ { "name": "Mike", "age": 24, "country": "England" }, { "name": "Jade", "age": 22, "country": "Mexico" } ] function myFunction(){ for(var i = 0; i < data.length; i++){ for (var key in data[i]) { if(typeof data[i][key] == "string"){ data[i][key] = data[i][key].toUpperCase(); } } } console.log(data); } </script> </body> </html>

Reminder

Hi Developers, we almost covered 100% of JSON Tutorials with examples for quick and easy learning.

We are working to cover every Single Concept in JSON.

Please do google search for:

Join Our Channel

Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.

This channel is primarily useful for Full Stack Web Developer.

Share this Page

Meet the Author