When generating a JSON with the code below:
JSONObject jsonObject = new JSONObject();
try {
jsonObject.put("Nome", c.getNome_fantasia().trim());
jsonObject.put("Apelido", c.getNome_razao_social().trim());
jsonArray.put(jsonObject);
} catch (JSONException ex) {
Logger.getLogger(ControllerLogicCliente.class.getName()).log(Level.SEVERE, null, ex);
throw new RuntimeException("Erro pupulando Clientes", ex);
}
The result is a JSON in the format:
[{"Nickname": "Flavio Benini", "Name": "Flavio Benini"}]
But typeahead works with it in the format below:
{Name: ["Flavio Benini"], Surname: ["Flavio Benini"]}
How to generate it Suitable format for typeahead?