This is part of a larger effort to unify the libspark build, and eliminate compile time differences between the builds used by our various services
34 lines
868 B
Bash
Executable File
34 lines
868 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# Define the bash array
|
|
# values=("value1" "value2" "value3")
|
|
values=$(dotnet sln DataStreamSuite.sln list | tail +3)
|
|
|
|
# Function to get the key for a value
|
|
get_key() {
|
|
local value=$1
|
|
# Replace this with your actual logic to get the key
|
|
echo "key_for_$value"
|
|
}
|
|
|
|
# Function to get the JSON array of child values for a value
|
|
get_children() {
|
|
local value=$1
|
|
# Replace this with your actual logic to get the JSON array of child values
|
|
echo '["child1", "child2", "child3"]'
|
|
}
|
|
|
|
# Create an empty JSON object
|
|
json_object="{}"
|
|
|
|
# Iterate through the array and construct the JSON object
|
|
for value in ${values[@]}; do
|
|
key=$(get_key "$value")
|
|
children=$(get_children "$value")
|
|
json_object=$(echo "$json_object" | jq --arg key "$key" --argjson children "$children" '. + {($key): $children}')
|
|
done
|
|
|
|
# Print the final JSON object
|
|
echo "$json_object"
|
|
|