How to create JSON Object from JavaScript?

Answered

How to create JSON Object from JavaScript?

Ninja Asked on 19th September 2018 in JSON.
Add Comment
1 Answer(s)
Best answer

JSON objects can be created with JavaScript. Let us see various ways of creating JSON objects using JavaScript:

Creation of an empty Object:
var JSONObj = {};

Creation of new Object:
var JSONObj = new Object();

Creation of an object with attribute employeename with value in string, attribute age with numeric value. Attributes is accessed by using ‘.’ operator:
var JSONObj = { “employeename “:”James”, “age”:25 };

Ninja Answered on 19th September 2018.
Add Comment