Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
</body>
</html>
 
var p = {
  'person': {
    'name': 'cc',
    'age': 12,
  }
}
var newObj = {};
var temp = {};
for (var a in p) {
  if (p.hasOwnProperty(a)) {
    temp = p[a];
    for (var b in p[a]) {
      if (p[a].hasOwnProperty(b)) {
        newObj[a + "." + b] = temp[b];
      }
    }
  }
}
console.log(newObj);
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers