English 中文(简体)
是否有办法在座标的所有阵列中添加一个先决条件?
原标题:Is there a way to add a prefix to all elements in array in jolt?

我要在一阵列的所有领域加上一个固定的序号。

这是投入:

{
  "input": [
    "1_ANY",
    "2_ANY",
    "3_ANY"
  ]
}

{
  "output" : [ "1", "2", "3" ]
}

预期产出:

{
  "output" : [ "01", "02", "03" ]
}

光谱:

[
  {
    "operation": "shift",
    "spec": {
      "input": {
        "*": {
          "*_*": {
            "$(0,1)": "output"
          }
        }
      }
    }
  }

]

是否有办法,我能否在一系列扼杀中的所有要素中增加一个固定的序号?

问题回答

您可向为进行以下分类而创建的单位添加改性-高标准:

[
  {
    "operation": "shift",
    "spec": {
      "input": {
        "*": {
          "*_*": {
            "$(0,1)": "output"
          }
        }
      }
    }
  },
  {
    "operation": "modify-overwrite-beta",
    "spec": {
      "output": {
        "*": "=concat( 0 ,@0)"
      }
    }
  }

]

或者你可以采取下列两种转移行动:

[
  {
    "operation": "shift",
    "spec": {
      "input": {
        "*": {
          "*_*": {
            "$": "0&(1,1)"
          }
        }
      }
    }
  },
  {
    "operation": "shift",
    "spec": {
      "*": {
        "$": "output"
      }
    }
  }

]




相关问题
JQuery/MVC Search Issue

I have inherited a piece of work where the entry screen shows a summary of 20 calculated variables. E.g. Var A (250), Var B (79). Clicking on any of these links takes the user to a view with a ...

jQuery quicksearch plug-in tinkering with JSON

I ve implemented the quicksearch plugin by Rik Lomas and I love it for an application in a custom CMS I m building. I was wondering though, since I m going to have a bizillion items in the table if ...

JSON with classes?

Is there a standardized way to store classes in JSON, and then converting them back into classes again from a string? For example, I might have an array of objects of type Questions. I d like to ...

PHP json_decode question

i m trying to use json_decode to combine a few json objects and then re-encode it. my json looks like: { "core": { "segment": [ { "id": 7, "...

Converting JSON data to Java object

I want to be able to access properties from a JSON string within my Java action method. The string is available by simply saying myJsonString = object.getJson(). Below is an example of what the string ...

热门标签