title: write all parameters jenkins in JSON file using ${params}
body: <p>I'm a beginner with shell scripting and i have some issues while a jenkins job parametrized. I want to write all parameters of jenkins job pipeline build with parameters into a JSON file using <code>${params}</code>!
  In my case i have 4 parameters(apis:multi-select,name:string,version:single-select and status:Boolean), there is the script Jenkinsfile</p>
  
  <pre><code>pipeline {
    agent any
      stages {
          stage('Build') {              
              steps {              
                  script{              
                     sh "./test.sh ${params}"
                  }
              }
          }
      }
  }
  </code></pre>
  
  <p>Content of test.sh</p>
  
  <pre><code>#!/bin/bash
  echo $@ &gt; file.json
  </code></pre>
  
  <p>The output in jenkins</p>
  
  <pre><code>+ ./test.sh [apis:dev,qa,prod, name:CC, version:g3, status:true]
  </code></pre>
  
  <p>Result in file.json</p>
  
  <pre><code>SyntaxError: JSON.parse: unexpected character at line 1 column 2 of the JSON data
  </code></pre>
  
  <p>My question is how format the output to obtain a clean result in file.json ? please i need help.</p>