From json array to Nextflow list of strings

Hello everybody!

I’m stuck so I ask for your help:

I have a process reading a json file as input, I want to output an “id” contained in this file and a list of file paths (contained in the “filePaths” array of the json file).

I’ve tried using the env() output but the output is not a list:

process parse_json_metadata {
  label 'jq' # linked to a container with the 'jd' command

  input:
    path(json_file)

  output:
    tuple env(id), env(seqs)

  script:
  """
  id="`jq .id ${json_file}`"
  arr=(`jq -r '.filePaths[]' ${json_file}`)
  seqs="`echo \${arr[@]}`"
  """
}

I obtain something like:
["some_identifier", filepath1 filepath2]

But I would like to have:
["some_identifier", ["filepath1", "filepath2", ..., "filepath_n"]]

How would you do it?