Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR 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));
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #convert #json #object #lowercase
ADD COMMENT
Topic
Name
9+6 =