Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //it will empty all values which are not object of object
- var emptyAllValues = function(obj) {
- for(var i=0; i<Object.keys(obj).length(;i++) {
- if(typeof obj[Object.keys(obj)[i]] == 'object') {
- obj[Object.keys(obj)[i]] = emptyAllValues(obj[Object.keys(obj)[i]]);
- }
- else {
- obj[Object.keys(obj)[i]]='';
- }
- }
- return obj;
- }
- var data = {
- "success": true,
- "data": {
- "personal": {
- "first_name": "Kenny",
- "last_name": "Ziemann",
- "sex": "M",
- "mobile": "(255) 266-3480"
- },
- "admin": {
- "id": 65,
- "address": {
- "city": "Lake Zetta",
- "state": "Kentucky",
- "country": "Cayman Islands",
- "pin_code": "72521",
- "street_name": "Larson Circles"
- },
- "year": 2006,
- "college": {
- "id": 29,
- "name": "copying college"
- },
- "program": {
- "id": 1,
- "name": "bachelor"
- },
- "stream": {
- "id": 7,
- "name": "Computer & Communication Engineering",
- "duration": 5
- }
- }
- },
- "role": {
- "name": "TPO",
- "level": 2
- }
- };
Add Comment
Please, Sign In to add comment