question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Use Array of JSON object to set() or setAll()

See original GitHub issue

Is there any way to use the array of JSON object to the setAll() method like the following?

{
  "backup": [
    {
      "id": 1,
      "name": "John Doe"
    },
    {
      "id": 2,
      "name": "Jane Doe"
    }
  ]
}

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
nathanbucharcommented, Apr 2, 2017

Oh, like modifying the array stored under in "backup"?

I’m afraid that’s not possible. Being that they are in an array, there’s no way to access those properties directly using object dot notation. You will need to get() the value at "backup", make the necessary modifications to the array, then set the value of "backup" to the updated array. Like so:

const backup = settings.get('backup');

backup[0].name = "Nate Doe";

settings.set('backup', backup);

Does this help?

0reactions
nathanbucharcommented, Apr 2, 2017

Let me know if you have any other questions!

Read more comments on GitHub >

github_iconTop Results From Across the Web

javascript set all values in array of object - Stack Overflow
Is it possible to simply set all the values to true or false at once (again i can use a for loop, but...
Read more >
Set all Object Properties to False in JavaScript | bobbyhadz
To set all properties of an Object to false , pass the object to the Object.keys() method to get an array of the...
Read more >
Java.util.Arrays.parallelSetAll(), Arrays.setAll() in Java
setAll() : It set all the element in the specified array in by the function which compute each element. Syntax:.
Read more >
JSON Data Set Sample
the JSON DataSet will create a row for each element in the JSON array, and store its value in a column named "column0"....
Read more >
ObjectNode (jackson-databind 2.5.0 API) - FasterXML
com.fasterxml.jackson.core.JsonToken, asToken(). Method that can be used for efficient type detection when using stream abstraction for traversing nodes.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found