Linked Questions
22 questions linked to/from How to get the key of a key/value JavaScript object
24
votes
3
answers
71k
views
How to get a listing of key value pairs in an object? [duplicate]
Possible Duplicate:
best way to get the key of a key/value javascript object
foo = {bar: "baz"}
How do you get a listing of all the properties and values within foo?
1
vote
2
answers
18k
views
how to get the value of the only key-value pair in object [duplicate]
I have a javascript object like below, a has only one key-value pair, how could I get the value of a1 without using iteration and also without knowing the key name(i.e a1) ?
a: {
a1:"...
-1
votes
1
answer
2k
views
JS get key name using map() [duplicate]
I have the following object:
{
"thumbnail": {
"height": 150,
"width": 150,
},
"medium": {
"height": 165,
&...
-2
votes
2
answers
2k
views
Convert an object to Array without putting key and value of Object.entries into a string In JavaScript [duplicate]
I want to convert an object like this:
let obj = {
arabicLang: false,
cancelVisitEmailAlert: false,
canselVisitSmsAlert: false
}
into an array of key-value pairs like this:
[
"arabicLang": ...
0
votes
1
answer
140
views
Getting values from Object in JavaScript [duplicate]
I need help in fetching values from a response object in an ajax call
Code Snippet
$.each(responseJson.slice(0,7), function (index) {
var resp_JSON=responseJson[index];
console.log(resp_JSON);
In ...
0
votes
0
answers
76
views
Finding an array element name [duplicate]
Ok, I have seen a couple closely related posts, but they don't seem to address my problem. Or at least not clearly enough for me.
I am receiving an object that is passed to me with no data dictionary ...
756
votes
31
answers
1.3m
views
How to get a key in a JavaScript object by its value?
I have a quite simple JavaScript object, which I use as an associative array. Is there a simple function allowing me to get the key for a value, or do I have to iterate the object and find it out ...
78
votes
8
answers
478k
views
How to access JSON Object name/value?
function (data) {
//add values based on activity type
//data = JSON.parse(data);
//alert(abc.Phone1);
alert(data.myName)
alert(data.toString());
if (activityType == "Phone") {...
7
votes
4
answers
43k
views
Get key using value from an object in JavaScript?
c = {
"UNKNOWN_ERR" : 0,
"INDEX_SIZE_ERR" : 1,
"DOMSTRING_SIZE_ERR" : 2,
"HIERARCHY_REQUEST_ERR" : 3,
"WRONG_DOCUMENT_ERR" : 4,
...
1
vote
9
answers
31k
views
Split object into 2 arrays javascript
I've got an object like that
obj = {
'baz':1,
'foo':7,
'zap':12,
'qax':15
}
I need to split it into 2 arrays
arr1 = ['baz', 'foo', 'zap', 'qax']
arr2 = [1, 7, 12, 15]
3
votes
5
answers
2k
views
What is the simplest way to Join a object as a space separated string in Javascript
All:
I want to build a string from a JS object( like build a toString method but like operator overload), for example:
var info = {name:"username",age:20};
var fmtinfo = info.join("||");
the fmtinfo ...
3
votes
4
answers
4k
views
How to get a key/value pair for an object
This question may sound very stupid, but I want to get a key/value pair for my object:
var a = {"e":1,"d":3,"f":4}
I tried with Object.keys(a) // returns ["e", "d", "f"]
this does not get me the ...
0
votes
4
answers
7k
views
Get key/values from JSON array of objects without knowing the key name
I'm trying to build a HTML table with data from a JSON structured array such as:
var myjson = [
{"firstName":"John", "lastName":"Doe"},
{"firstName":"Anna", "lastName":"Smith"},
{"firstName":"Peter","...
6
votes
5
answers
1k
views
How to extract all possible matching arrays of objects from one array of objects?
I have an array of objects, e.g.
var arr = [
{"a": "x"},
{"b": "0"},
{"c": "k"},
{"a": "nm"},
{"b": "765"},
{"ab": "i"},
{"bc": "x"},
{"ab": "4"},
{"abc": "L"}
];...
1
vote
4
answers
2k
views
How to loop through the 'key' value of an object with AngularJS?
I have the following data and HTML template (and other code in app.js obviously). The code in my "tbody" works perfectly, and displays a table like this:
current output
--------------------
| AAPL | ...