Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

json example

{
    "name": "Muhammad Ishaq",
    "gender": "Male",
    "age": 23,
    "address": {
        "street": "87",
        "city": "Gultari Matyal Skardu",
        "state": "Gilgit Baltistan",
        "postalCode": "16350"
    },
    "phoneNumber": [
        { "type": "personal", "number": "116263747" }
    ]
}
Comment

json example

{
   "todos": [
      {
         "userId": 1,
         "id": 1,
         "title": "delectus aut autem",
         "completed": false
      },
      {
         "userId": 1,
         "id": 2,
         "title": "quis ut nam facilis et officia qui",
         "completed": false
      },
      {
         "userId": 1,
         "id": 3,
         "title": "fugiat veniam minus",
         "completed": false
      },
      {
         "userId": 1,
         "id": 4,
         "title": "et porro tempora",
         "completed": true
      },
      {
         "userId": 1,
         "id": 5,
         "title": "laboriosam mollitia et enim quasi adipisci quia provident illum",
         "completed": false
      },
      {
         "userId": 1,
         "id": 6,
         "title": "qui ullam ratione quibusdam voluptatem quia omnis",
         "completed": false
      },
      {
         "userId": 1,
         "id": 7,
         "title": "illo expedita consequatur quia in",
         "completed": false
      },
      {
         "userId": 1,
         "id": 8,
         "title": "quo adipisci enim quam ut ab",
         "completed": true
      },
      {
         "userId": 1,
         "id": 9,
         "title": "molestiae perspiciatis ipsa",
         "completed": false
      },
      {
         "userId": 1,
         "id": 10,
         "title": "illo est ratione doloremque quia maiores aut",
         "completed": true
      }
   ]
}
Comment

json example

{
	"users": [{
			"name": "Emp1",
			"full_name": "Emp1 lastname",
			"emp_id": "Emp1122",
			"gender": "M",
			"age": 23,
			"company": "Test Company",
			"address": {
				"city": "Mumbai",
				"state": "Maharashtra",
				"state_code": "MH",
				"zip": "16350",
				"county": "India",
				"county_code": "IN"
			},
			"contact": [{
					"type": "phone",
					"phone_number": "1234567890"
				},
				{
					"type": "email",
					"email_id": "emp1@idstest.com"
				}
			]
		},
		{
			"name": "Emp1",
			"full_name": "Emp1 lastname",
			"emp_id": "Emp1122",
			"gender": "M",
			"age": 23,
			"company": "Test Company",
			"address": {
				"city": "Mumbai",
				"state": "Maharashtra",
				"state_code": "MH",
				"zip": "16350",
				"county": "India",
				"county_code": "IN"
			},
			"contact": [{
					"type": "phone",
					"phone_number": "1234567890"
				},
				{
					"type": "email",
					"email_id": "emp1@idstest.com"
				}
			]
		}
	]
}
Comment

json example

const myList = document.querySelector('ul');
const myRequest = new Request('products.json');

fetch(myRequest)
  .then((response) => response.json())
  .then((data) => {
    for (const product of data.products) {
      const listItem = document.createElement('li');
      listItem.appendChild(
        document.createElement('strong')
      ).textContent = product.Name;
      listItem.append(
        ` can be found in ${
          product.Location
        }. Cost: `
      );
      listItem.appendChild(
        document.createElement('strong')
      ).textContent = `£${product.Price}`;
      myList.appendChild(listItem);
    }
  })
  .catch(console.error);
Comment

JSON Example

 const x = {a:"aaaaa", b: function(){return this.a}, c: function(){this.a}};
 console.log(x.b());
/* const x = {a:"aaaaa", b:  this.a, c: this.a};
 console.log(x.b);
 will return undefined
*/
Comment

JSON Use Example

function get(value, p)
{
console.log(p[value]);
}
get("x", {x:"XXX%%$$$%$%#$%#"});
Comment

PREVIOUS NEXT
Code Example
Javascript :: react.js form 
Javascript :: How to Add Main Module API to Renderer process 
Javascript :: validar fecha jquery 
Javascript :: Another _extend Example 
Javascript :: use stigviewr 
Javascript :: santance case in javascript 
Javascript :: find result using type: mongoose.Schema.ObjectId, 
Javascript :: asp.net updatepanel autoscroll fix 
Javascript :: how to filter through an array of objects 
Javascript :: prisma nested create 
Javascript :: Quick JS DATE 
Javascript :: How to set canvas height and width dynamically 
Javascript :: Argument #1 ($client) must be of type AwsS3Client, AwsS3S3Client given 
Javascript :: javascript get object list by value 
Javascript :: how to use script tag in javascript 
Javascript :: node js swear filter 
Javascript :: Search an elemnt in a sorted and rotated array 
Javascript :: jquery to javascript converter online free 
Javascript :: click mouseup mousedown 
Javascript :: listen to props deep change in vue js 2 
Javascript :: count repeated characters in a string in react 
Javascript :: javascript complex literal 
Javascript :: how to compile javascript class to function 
Javascript :: alternative of tofixed javascript 
Javascript :: jsdoc run for all files in folder 
Javascript :: web3 returns an object promise instead of number 
Javascript :: js num to str 
Javascript :: angularjs How to add row after the last row in ng2 smart table 
Javascript :: Understanding higher order JavaScript functions 
Javascript :: Check if a user joins, leaves, or moves channels discord.js 
ADD CONTENT
Topic
Content
Source link
Name
3+7 =