title: How to Convert following String to Json using Java?
body: <p>I need to convert the following string into json format.</p>
  
  <p>Below is the input as well as the expected output for reference.</p>
  
  <p>Input:</p>
  
  <pre><code>Employee Driver Report - EDR
  --------------------------------
  Employee Nbr: 123480 Employee Type: DI Cat: UPL
  Driver License: PP3P30 Plate: ROWP
  Part Number: 1006096
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>{
  "Employee Nbr": "123480",
  "Employee Type": "DI",
  "Cat": "UPL",
  "Driver License": "PP3P30",
  "Plate": "ROWP",
  "Part Number": "1006096",
  }
  </code></pre>
  
  <p>Sample Code:</p>
  
  <pre><code>Map&lt;String, String&gt; keyValueMap = new HashMap&lt;String, String&gt;();
  String[] lines = rawText.split(System.getProperty("line.separator"));
  for(String line: lines) {
  .......
     keyValueMap.put(keyAndValues[i], keyAndValues[i + 1]);
  }
  Gson gson = new GsonBuilder().setPrettyPrinting().create();
  String json = gson.toJson(keyValueMap);
  </code></pre>
  
  <p>Could you please help me on how to resolve this?</p>
  
  <p>Thanks in advance.</p>