title: Convert text file with key=value pair to specific json format in jq
body: <p>I have a text file with  following values in 
  input.txt</p>
  
  <pre><code>key1=value1\r
  key2=value2
  key3=value3\r
  key4=value4
  </code></pre>
  
  <p>need the jq rexpression to convert it to  below json format  by removing "\r" also</p>
  
  <p>output.json</p>
  
  <pre><code>{
  "Environment": {
      "Variables": {
          "key1": "value1",
          "key2": "value2",
          "key3": "value3",
          "key4": "value4"
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>I have tried the below expression and getting the </p>
  
  <pre><code>jq -Rs [ split("\n")[] | select(length &gt; 0) | split("=") | {(.[0]): .[1]} ] 
  </code></pre>
  
  <p>and getting the below output</p>
  
  <pre><code>[
    {
     "key1ey1": "Value1\r"
    },
    {
     "key2": "value2"
    },
    {
     "key3": "value3\r"
    },
    {
     "key4": "value4"
    }
  
  ]
  </code></pre>