Array Support with JSONs
See original GitHub issueDoes 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:
- Created 5 years ago
- Comments:7
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
“my_array”: [ “value1”, “value2” ],
So how can we change these settings?
@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. 😃