Linked Questions

89 questions linked to/from JavaScript: Object Rename Key
0 votes
1 answer
10k views

I have an array of objects where I want to rename the key name as shown: let Options = [{Code: 1, Label: 'abc'}, {Code: 2, Label: 'xyz'}, {Code: 3, Label: 'fgh'}]; I want to change the key 'Code' to '...
Mohsin's user avatar
  • 93
3 votes
2 answers
822 views

I have following input: { foo: 4, bar: 3 } I want to modify the keys of this object to get: { x_foo_y: 4, x_bar_y: 3 } Is it possible to modify the object without creating new one ? (jQuery ...
hsz's user avatar
  • 153k
2 votes
2 answers
6k views

I have an object like {Text Field 1: {fieldName: "Text Field 1", fieldType: "text", data: "custom value"}, Text Field 2: {fieldName: "Text Field 3", fieldType: &...
1 vote
4 answers
224 views

I have an existing object, this.data = { "part": "aircraft", "subid": "wing", "information.data.keyword": "test", "fuel.keyword": "lt(6)" } What I'm trying to do is to check every key and ...
Dexter's user avatar
  • 538
1 vote
1 answer
874 views

I have a list of object, each object has a field name: let data = [{name: 'foo'}, {name: 'bar'}, {name: 'ipsum'}]; I would like to rename the name field to title. I tried following: data.map(el => ...
user842225's user avatar
  • 6,139
-1 votes
1 answer
1k views

Let's say I have an object named data: { first: 'Zaaac', last: 'Ezzell', title: 'Mrs', mail: '[email protected]', cellphone: '+444444', phone_2: '6506679207', address_2: ...
Kuyashii's user avatar
  • 394
0 votes
2 answers
711 views

I'm new to javascript and have a question : i want to change keys if their value is number for example. What's wrong with my code? const order = { wine : 100, vodka : 200, beer : 300, ...
Max M's user avatar
  • 1
-1 votes
2 answers
323 views

Say I have some JSON data like this: blah = [ {"Species":"setosa","Sepal.Length":5.1,"Sepal.Width":3.5},{"Species":"setosa","Sepal.Length":4.9,"Sepal.Width":3} ] In my code, I won't necessarily know ...
jalapic's user avatar
  • 14.3k
0 votes
2 answers
151 views

I have got an object: blocks: [ { type: 'animal', data: { text: 'Bark bark' } }, { type: 'human', data: { text: 'Speak speak' } }, ... ] The data: naming does not fit my ...
Marian Rick's user avatar
  • 3,465
0 votes
0 answers
272 views

I have the following JSON object: { "_id": "123", "name": "aa", "description": "sdweok", "category": "11123", "tags": ["aasdsd"], "extraData": { "brand" : "oksdf", ...
Giannis's user avatar
  • 492
-2 votes
1 answer
233 views

If I have the following object, how can I redefine the keys to remove the prefix "Class"? { ClassName: "John", ClassEmail: "[email protected]", ClassPhone: "...
rjpedrosa's user avatar
  • 692
0 votes
1 answer
136 views

I'am trying to develop a nodejs service that will work as a proxy between my apis and third party apis. What I need to implement is a system capable of receiving multiple api responses and "translate" ...
1 vote
3 answers
163 views

If I have a JavaScript array including 10 objects with the following syntax: const myArray = [{Age: 10, Name: Justin}, {Age: 15, Name: Bob}, ..., {Age: 20, Name: Jon}]; What's the most efficient way ...
uppal2665's user avatar
-1 votes
1 answer
121 views

Guys Im a bit new to javascript. I have the following code. I need to assign a string name to the data object. How can I convert this object const obj= { data: [ { name: "subject", note: ...
0 votes
0 answers
62 views

I want to access and edit a **nested ** key in the object (not the value but the key itself). eg; { "name": { "firstname": "Boba", "lastName": "...

15 30 50 per page
1
2 3 4 5 6