Update value in the nested json

a!localVariables(
  local!metadataJSON: if(
    a!isNotNullOrEmpty(ri!metadataJSON),
    a!fromJson(ri!metadataJSON),
    null
  ),
  local!result: a!forEach(
    items: local!metadataJSON,
    expression: a!localVariables(
      local!section: fv!item,
      a!forEach(
        items: local!section.questions,
        expression: a!localVariables(
          local!questionrow: fv!item.questionrow,
          a!forEach(
            items: local!questionrow,
            expression: 
              if(
                fv!item.questiontitle = ri!targetField,
                updatedictionary(fv!item,
                {
                  "responsetext": ri!value
                }),
                null
              )
          )
        )
      )
    )
  ),
  local!metadataJSON
)

I have a nested json. I need to update its field "responestext" if its questiontitle is equal to the parameter. Then return the new json. But the original variable metadataJSON is not updated. Is there any function to update the origin value?

  Discussion posts and replies are publicly visible

Parents Reply Children