In my scala code i have a json object consisting email data
val messages = inboxEmail.getMessages();
var jsonArray = new JsArray
for(inboxMessage <- messages)
{
...
...
val emailJson = Json.obj("fromAddress" -> fromAddressJsonList, "toAddress" -> toAddressJsonList, "ccAddress" -> ccAddressJsonList, "bccAddress" -> bccAddressJsonList, "subject" -> emailMessage.getSubject().toString(), "message" -> Json.toJson(emailMessageBody))
I need to add emailJson to the jsonArray during each loop
i tried
jsonArray.+:(emailJson)
and
jsonArray.append(emailJson)
but getting empty array
What should i use here to add jsonObject into the json array