Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

convert json object to lowercase

var x = { id: 0, name: "SAMPLe", forms: { formId: 0, id: 0, text: "Sample Text" }};

function lower(obj) {
  for (var prop in obj) {
  if (typeof obj[prop] === 'string') {
    obj[prop] = obj[prop].toLowerCase();
  }
  if (typeof obj[prop] === 'object') {
    lower(obj[prop]);
    }
  }
  return obj;
}


console.log(lower(x));
Comment

PREVIOUS NEXT
Code Example
Javascript :: React Native typescript start new project 
Javascript :: access mouse position javascript 
Javascript :: how to make a github api using react 
Javascript :: bootstrap searchable pagination table example jquery 
Javascript :: Missing script: "start" react 
Javascript :: nodejs exit code 
Javascript :: document.print js 
Javascript :: make multiple api call using promise.all 
Javascript :: how to make a timer in javascript 
Javascript :: silent keylogger browser 
Javascript :: Javascript - convert string value to lowercase 
Javascript :: callback function 
Javascript :: mongodb replace string 
Javascript :: children javascript 
Javascript :: get second element with a class jquery 
Javascript :: uint8array javascript 
Javascript :: how to enable emit on react in vs code 
Javascript :: js add class to html 
Javascript :: javascript delay some seconds 
Javascript :: react native shadow android 
Javascript :: how to increment variable value in javascript 
Javascript :: how to store object in session storage 
Javascript :: how to change port in react js 
Javascript :: react native use route params 
Javascript :: lodash find duplicate element index 
Javascript :: get file extension file upload control in javascript 
Javascript :: loop javascript 
Javascript :: flutter http get json to map 
Javascript :: push object to json array 
Javascript :: react eslint 
ADD CONTENT
Topic
Content
Source link
Name
2+4 =