While JObject maps well to clearly defined JavaScript objects, it can be somewhat tedious to work with when calling functions that expect object parameters. Especially if the library allows for optional fields inside these objects. If you use JObject and strict definitions you quickly end up with a myriad of variations of the same structure, and it becomes more complex than it has to be.


In such cases it is much easier to use an anonymous object instead, which is created ad-hoc as a part of an assignment.


To create a JS object "on the fly" you can do this:


var a := class

 id := 10;
 value := 180.00;

 name := "string data";

 end;


Which is the same as writing (in JavaScript):


var a = {

 id: 10;

 value: 180.000;

 name: "string data";

}


A pure anonymous object makes the otherwise tedious work of interfacing with external libraries much, much easier. And yes, you can use this directly in a parameter setting too:


someFunction(

 "first param",

 class

   value1: "hello";
   value2: 1200;

 end,

 "third param"

 );