Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <style>
- body{
- background-color: #FFFFFF;
- font-family: Arial, Helvetica, sans-serif;
- }
- </style>
- </head>
- <body>
- <h2>JsonLoad</h2>
- <script>
- var jsonSource = [
- {"title-a":"subject-0", "title-b":"thread-0"},
- {"title-a":"subject-1", "title-b":"thread-1"},
- {"title-a":"subject-2", "title-b":"thread-2"},
- ];
- var keyList = [];
- var valueList = [];
- for (i = 0; i < jsonSource.length; i++) {
- var thisObject = jsonSource[i];
- for(var k in thisObject){
- if(i == 0){
- keyList.push(k) ; // push key names
- };
- valueList.push(thisObject[k]); // push key values
- }
- }
- console.log("keyList:" + keyList);
- console.log("valueList:" + valueList);
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement