How to append Json.obj into Json.arr Scala? <p>I am newbie to <strong>Scala</strong>.</p> <p>I want to append <strong>Json.obj</strong> into <strong>Json.arr</strong> during runtime in Scala. </p> <p><strong>Json Object:</strong> </p> <pre><code>var x: JsValue = Json.obj("name" -&gt; "Fiver", "age" -&gt; 4,"role" -&gt; JsNull) </code></pre> <p><strong>Json Array:</strong></p> <pre><code>var y: JsValue = Json.arr(x) </code></pre> <p>Here, I am able to append single Json.obj to Json.arr but I want to add multiple Json.obj to Json.arr dynamically.</p> <p>I can do like this:</p> <pre><code>var y: JsValue = Json.arr( Json.obj("name" -&gt; "Fiver", "age" -&gt; 4,"role" -&gt; JsNull), Json.obj("name" -&gt; "Fiver", "age" -&gt; 4,"role" -&gt; JsNull) ) </code></pre> <p>but it is <strong>not</strong> appending in one by one. I want to append <strong>Json.Obj</strong> dynamically.</p>