Linked Questions
51 questions linked to/from JavaScript object vs. JSON
0 votes
5 answers
227 views
JSON and javascript objects [duplicate]
var foo = { "a": 1, "b": true, c: [1, true, "2"] }; Please correct me if I'm wrong here, but as far as I know, this is a valid json object. But it's also a javascript object. Are JSON objects based ...
0 votes
1 answer
82 views
understanding Javascript objects syntax [duplicate]
<!DOCTYPE html> <html> <body> <p>Creating a JavaScript Object.</p> <p id="demo"></p> <script> var person = { ...
567 votes
15 answers
602k views
What is JSON and what is it used for?
I've looked on Wikipedia, googled it, and read the official documentation, but I still haven't got to the point where I really understand what JSON is, and why I'd use it. I have been building ...
170 votes
4 answers
665k views
Create JSON object dynamically via JavaScript (Without concate strings)
I have this JSON data: { "employees": [ { "firstName": "John", "lastName": "Doe" }, { "firstName": "Anna", "lastName": "...
5 votes
7 answers
31k views
Transform JSON Object to another - Format It
I want to transform a JSON formatted output to another. How I can do this? Example: Old JSON "data": [ { "id" : "e49e183e-9325-4e62-8eda-7e63fb7cdbbd", ...
3 votes
4 answers
30k views
How do I add items to a nested Array?
Say I have an array such as this in Javascript: var cars = { vendor: [ { type: [ 'camry', 'etc' ] } ] } In Javascript what command can I use to add an item to type... For example if I wanted to have ...
8 votes
3 answers
14k views
Variable in JSON path
I would like to make the path to data contained in JSON variable. The code I have now looks like this: function writeDB(block) { $.getJSON('js/data.js', function(data) { if (block == "path1") {...
1 vote
3 answers
17k views
Parsing JSON under Array object
I have a simple JSON string, encapsulated in an array created using JSONArray and JSONObject form org.json in Java. var outObjA = [{"LoginTime":"2018-02-14 08:51:48.0","User":"f00dl3","RemoteIP":"127....
-2 votes
4 answers
8k views
How to update Json object value dynamically in jquery?
var jsonObj = [ { "key1": "value1", "key2": "value2", "key3": "value3" }, { "key1": "value1", "key2": "value2", "key3": "value3" } ...
1 vote
2 answers
10k views
How to display Json Data in ReactJs
I have this code where I am just trying to display a Json Data but it returns undefined var dataW = [ { empAverage:3, reviewerAverage:4, stdAverageOfTask:1 } ] var ...
0 votes
1 answer
4k views
NodeJS and PDFkit: 'margin' property gives "Unexpected identifier" error?
I have successfully gotten my code to output a pdf, but when I attempt to adjust the margins using the 'margin' property listed in the documentation using the following code, var pdf = require ('...
-1 votes
4 answers
4k views
Is it not possible to store function as JSON key value in .json file in angular 5
We have an Angular 5 project in which we have a .json file which we're loading in a .ts file using XMLHttpRequest. The .json file have the following content: { stringKey: "stringValue", ...
5 votes
2 answers
117 views
Convert Array of Object to Regular JavaScript Object
I have the following array objects var stats = [ [0, 200,400], [100, 300,900],[220, 400,1000],[300, 500,1500],[400, 800,1700],[600, 1200,1800],[800, 1600,3000] ]; I would like to know how to ...
1 vote
3 answers
3k views
Sort object array with undefined and null values
How can I sort an object array which has null and undefined values using javascript. My target is to show items that has property of "jobTitle" first, order them by rating, then items with no "...
0 votes
3 answers
4k views
Simple Jquery Ajax Get JSON data function
I am trying to create a simple little jquery function that pulls JSON data from the url, then goes through each of the objects. All I want to do is to console.log the object.name so that I know that ...