Answers for "array in json"

41

object to json javascript

var person={"first_name":"Tony","last_name":"Hawk","age":31};
var personJSONString=JSON.stringify(person);
Posted by: Guest on July-23-2019
7

json example array

{
	"name":"John",
	"age":30,
	"cars":[ "Ford", "BMW", "Fiat" ]
}

// Another exemple
{
    "people": [
        {
            "website": "stackabuse.com",
            "from": "Nebraska",
            "name": "Scott"
        },
        {
            "website": "google.com",
            "from": "US",
            "name": "Zuck"
        }
    ]
}
Posted by: Guest on January-14-2021
1

js create json array

var employees = {
    accounting: []
};

for(var i in someData) {    

    var item = someData[i];   

    employees.accounting.push({ 
        "firstName" : item.firstName,
        "lastName"  : item.lastName,
        "age"       : item.age 
    });
}
Posted by: Guest on October-30-2020
3

json object

var myObj, x;
myObj = {"name":"John", "age":30, "car":null};
x = myObj.name;
document.getElementById("demo").innerHTML = x;
Posted by: Guest on April-16-2020
3

json object array

const Object = {a:1,
                 b:'ab'
                };


const Array = [1,
                 'ab',
                 4
                ];
Posted by: Guest on May-14-2021
0

Array as JSON

const text = '["Ford", "BMW", "Audi", "Fiat"]';

const myArr = JSON.parse(text);
Posted by: Guest on August-05-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language