title: Converting CSV to JSON in bash
body: <p>Trying to convert a CSV file into a JSON </p>
  
  <p>Here is two sample lines : </p>
  
  <pre><code>-21.3214077;55.4851413;Ruizia cordata
  -21.3213078;55.4849803;Cossinia pinnata
  </code></pre>
  
  <p>I would like to get something like : </p>
  
  <pre><code>"occurrences": [
                   {
                  "position": [-21.3214077, 55.4851413],
                  "taxo": {
                      "espece": "Ruizia cordata"
                   },
                   ...
               }]
  </code></pre>
  
  <p>Here is my script : </p>
  
  <pre><code>    echo '"occurences": [ '
  
  cat se.csv | while read -r line
    do
        IFS=';' read -r -a array &lt;&lt;&lt; $line;
        echo -n -e '{ "position": [' ${array[0]}
        echo -n -e ',' ${array[1]} ']'
        echo -e ', "taxo": {"espece":"' ${array[2]} '"'
  done
  echo "]";
  </code></pre>
  
  <p>I get really strange results : </p>
  
  <pre><code>   "occurences": [ 
   ""position": [ -21.3214077, 55.4851413 ], "taxo": {"espece":" Ruizia cordata
   ""position": [ -21.3213078, 55.4849803 ], "taxo": {"espece":" Cossinia pinnata
  </code></pre>
  
  <p>What is wrong with my code ? </p>