我正在使用jq
在bash中转换JSON。如何在jq中将bash变量的值用作JSON属性?
#!/bin/bash
TableName="Test"
aws dynamodb scan --table-name ${TableName} --endpoint-url http://localhost:8000 \
| jq --arg TableName ${TableName} '{ "$TableName": [.Items[] | {PutRequest: {Item: .}}]}' >
产生:
{
"$TableName": [
{
...
我希望它是
{
"Test": [
{
...