我如何解析来自firebase的数据并存储到各个变量

时间:2018-02-18 03:54:25

标签: javascript json firebase firebase-realtime-database

  firebase.initializeApp(config);

     var database = firebase.database();
    var leadsRef = database.ref('messages');
    leadsRef.on('value', function(snapshot) {
    snapshot.forEach(function(childSnapshot) {
      var childData = childSnapshot.val();

       console.log(childData);   
    });
});

我收到以下输出

{activityCatagory: "immediate", company: "test", email: "test@gmail.com", github: "test", linkedin: "test", …}
activityCatagory
:
"immediate"
company
:
""
email
:
"test@gmail.com"
github
:
""
linkedin
:
""
message
:
"Software engineering/Machine learning/Image Processing.↵Skills ↵•  Programming: C, Python, C++.↵•  Software Skills: MATLAB, Microsoft Office Suite, Mathematica, Visual Studio.↵•  Platforms: Microsoft Windows, Linux.↵•  Libraries: OpenCV, Scikit, Tensor flow."
name
:
"test"
phone
:
"000000000"
salary
:
""
__proto__
:
constructor
:
ƒ Object()
hasOwnProperty
:
ƒ hasOwnProperty()
isPrototypeOf
:
ƒ isPrototypeOf()
propertyIsEnumerable
:
ƒ propertyIsEnumerable()
toLocaleString
:
ƒ toLocaleString()
toString
:
ƒ toString()
valueOf
:
ƒ valueOf()
__defineGetter__
:
ƒ __defineGetter__()
__defineSetter__
:
ƒ __defineSetter__()
__lookupGetter__
:
ƒ __lookupGetter__()
__lookupSetter__
:
ƒ __lookupSetter__()
get __proto__
:
ƒ __proto__()
set __proto__
:
ƒ __proto__()

{activityCatagory: "immediate", company: "test1", email: "test1@gmail.com", github: "test", linkedin: "test", …}
activityCatagory
:
"immediate"
company
:
""
email
:
"test1@gmail.com"
github
:
""
linkedin
:
""
message
:
"Software engineering/Machine learning/Image Processing.↵Skills ↵•  Programming: C, Python, C++.↵•  Software Skills: MATLAB, Microsoft Office Suite, Mathematica, Visual Studio.↵•  Platforms: Microsoft Windows, Linux.↵•  Libraries: OpenCV, Scikit, Tensor flow."
name
:
"test1"
phone
:
"000000000"
salary
:
""
__proto__
:
constructor
:
ƒ Object()
hasOwnProperty
:
ƒ hasOwnProperty()
isPrototypeOf
:
ƒ isPrototypeOf()
propertyIsEnumerable
:
ƒ propertyIsEnumerable()
toLocaleString
:
ƒ toLocaleString()
toString
:
ƒ toString()
valueOf
:
ƒ valueOf()
__defineGetter__
:
ƒ __defineGetter__()
__defineSetter__
:
ƒ __defineSetter__()
__lookupGetter__
:
ƒ __lookupGetter__()
__lookupSetter__
:
ƒ __lookupSetter__()
get __proto__
:
ƒ __proto__()
set __proto__
:
ƒ __proto__()

我正在尝试为以下数据构建html表

0 个答案:

没有答案