JSON - stands for JavaScript
Object Notation
Create object:
var arr = {
employees: []
};
Add to array values:
arr. employees.push({
"FirstName": "adi", "LastName": "Avera",
"Age": 25 });
Getting data from array:
arr. employees [0]. FirstName
arr. employees [0]. LastName
arr. employees [0]. Age
Full example:
<script type="text/javascript">
var arr = {
var arr = {
employees: []
};
arr. employees.push({ "FirstName": "adi", "LastName": "Avera", "Age": 25 });
arr. employees.push({ "FirstName": "adi", "LastName": "Avera", "Age": 25 });
document.write(arr. employees
[0]. FirstName + ' ' + arr. employees [0]. LastName +' ' + arr. employees
[0]. Age + '<br>');
</script>
</script>
Result:
adi Avera 25
No comments:
Post a Comment