title: Pretty JSON multi reg to one line JSON multi reg
body: <p>I have a String with many records in JSON Format. I have to convert each JSON record to one-line JSON record. </p>
  
  <p>Example:
  Input:</p>
  
  <pre><code>{
    "field1" : "aa11",
    "field2" : "aa22",
    "structField" : {
      "sf1" : "aaa11",
      "sf2" : "aaa22"
    }
  }, {
    "field1" : "bb11",
    "field2" : "bb22",
    "structField" : {
      "sf1" : "bbb11",
      "sf2" : "bbb22"
    }
  }, {
    "field1" : "cc11",
    "field2" : "cc22",
    "structField" : {
      "sf1" : "ccc11",
      "sf2" : "ccc22"
    }
  }
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>{"field1":"aa11","field2":"aa22", "structField":{"sf1" : "aaa11","sf2" : "aaa22"}},
  {"field1":"bb11","field2":"bb22","structField":{"sf1" : "bbb11","sf2" : "bbb22"}}, 
  {"field1" : "cc11","field2" : "cc22","structField" : {"sf1" : "ccc11","sf2" : "ccc22"}}
  </code></pre>
  
  <p>I am using Scala to try to parse the String and split it by <code>"}, {"</code> and reformat my json:</p>
  
  <pre><code>myMultiJSONString.
    substring(2,myMultiJSONString.length-2).
    split("\\}, \\{").
    map(reg =&gt; "{" + reg.trim.replaceAll("\\n","") + "}")
  </code></pre>
  
  <p>I think this is a dirty way.</p>
  
  <p>¿Is there some library wich can help with this stuff?</p>
  
  <p>For example, deserializing JSON String to "something" and serializing later in one-line JSON String.</p>
  
  <p>Any idea?</p>
  
  <p>Thanks!</p>