Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- "subscriptionId" : "5a268a598dc68904bbc7b3cf",
- "originator" : "localhost",
- "contextResponses" : [
- {
- "contextElement" : {
- "type" : "Temperatura",
- "isPattern" : "false",
- "id" : "S_Temp001",
- "attributes" : [
- {
- "name" : "Tem_int",
- "type" : "float",
- "value" : 2,
- "metadatas" : [
- {
- "name" : "accuracy",
- "type" : "Float",
- "value": 2 }
- ]
- },
- {
- "name" : "Tem_out",
- "type" : "Integer",
- "value" : 1
- }
- ]
- },
- "statusCode" : {
- "code" : "200",
- "reasonPhrase" : "OK"
- }
- }
- ]
- }
- var json = {
- "name": {
- "first": "Yosuke",
- "family": "Kyra"
- },
- "birth": {
- "year": 1982,
- "month": 12,
- "day": 5
- }
- }
- // Destructuring
- var {name: { family: familyName }, birth: {day: birthDay}} = json
- console.log(familyName) // return Kyra
- console.log(birthDay) // return 5
- var json = {
- // tu Json
- };
- for (var ele in json) {
- //aquĆ para los que son objetos
- if (typeof(json[ele]) == 'object') {
- eachobject(json[ele]);
- } else {
- console.log('ele --> ', ele, ' - ', json[ele]);
- console.log('typo del ele --> ', typeof(json[ele]));
- console.log(' --------------------- ');
- }
- }
- function eachobject(json) {
- for (var ele in json) {
- if (typeof(json[ele]) == 'object') {
- eachobject(json[ele]);
- } else {
- console.log('ele --> ', ele, ' - ', json[ele]);
- console.log('typo del ele --> ', typeof(json[ele]));
- console.log(' --------------------- ');
- }
- }
- }
Add Comment
Please, Sign In to add comment