How do I represent an Array<Dynamic> literal in haxe?
17:15 21 Jan 2026

In haxe, [1, 2, 3] creates an array. All the members must be of the same type. If you want to create an array where the elements are of different types, you need to explicitly tell the compiler that it's an Array. The [example in the documentation](https://haxe.org/manual/std-Array.html) suggests this:

var myExplicitArray:Array = [10, "Sally", true];

But that defines a new variable. What do I do if I want to use the array, as a literal, in some other structure? Such as, in my case, creating a large, complex JSON structure?

Or, in other words, how do I do this:

doSomethingWithJson([1, ["value" => 2], "three"]);

(As an aside, the same problem applies with mixed-type maps.)

haxe