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.

Array Support with JSONs

See original GitHub issue

Does this tasks support replacing an item in a JSON array in configuration?

Suppose I have this json:

{
    "my_array" : [
        {"value" : 1},
        {"value" : 2}
    ]
}

and I want to transform it to

{
    "my_array" : [
        {"value" : 1},
        {"value" : 5}
    ]
}

what would be the path to do that?

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
Patryxcommented, Nov 14, 2018

“my_array”: [ “value1”, “value2” ],

So how can we change these settings?

1reaction
gpin1120commented, Aug 7, 2018

@Sigman32 Thanks for sharing! I have some questions regarding this,

I have a simple array like this in my configs

“my_array”: [ “value1”, “value2” ], In the transform task I added this “my_array[0]” : “value1” “my_array[1]” : “value2”

The end result is a new entry at the end of the config exactly like the following, seems like the task isn’t evaluating it as an array but rather as strings “my_array[0]” and “my_array[1]” “my_array[0]” : “value1” “my_array[1]” : “value2”

If I do this however, it adds new additional items in the array without issues “my_array[]” : “value1” “my_array[]” : “value2”

Do you have any ideas what I might be doing wrong? Thank you. 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

JSON Array - Multi-dimensional Array in JSON - REST
JSON array can store string , number , boolean , object or other array inside JSON array. In JSON array, values must be...
Read more >
JSON Array Structure
A JSON array contains zero, one, or more ordered elements, separated by a comma. The JSON array is surrounded by square brackets [...
Read more >
What is JSON Array
JSON Array is almost same as JavaScript Array. JSON array can store values of type string, array, boolean, number, object, or null.
Read more >
Can an array be top-level JSON-text?
Yes, an array is legal as top-level JSON-text. There are four standard documents defining JSON: RFC 4627, RFC 7159 (which obsoletes RFC ...
Read more >
array — Understanding JSON Schema 2020-12 ...
There are two ways in which arrays are generally used in JSON: List validation: a sequence of arbitrary length where each item matches...
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