Fresco Play JSON Hands-On Solution
1. Schema Validation
module.exports= function(){
const data = require("./testdata.json");
/*Explore the JSON file and return required JSON data*/
var json = JSON.parse(data).studentData;
json.forEach(function(element, index){
element['aggregate'] = parseInt(element['aggregate']);
element.forEach(function(per,ind){
per['sub1'] = parseInt(per['sub1']);
per['sub2'] = parseInt(per['sub2']);
per['sub3'] = parseInt(per['sub3']);
});
});
return json;
}
2. Person Object
{
"persons":{
"Name":"Notes Bureau",
"EmployeeID": 12321,
"Experience" : 3,
"Company": "Notes Bureau",
"Designation": "Software Engineer"
}
}
3. Food Item Object
[
{"Name":"Notes Bureau","Type":"Notes Provider","Price":0},
{"Name":"Notes Bureau","Type":"Solution Provider","Price":0},
{"Name":"Notes Bureau","Type":"Content Provider","Price":0}
]
Comments
Post a Comment