In [1]:
using JSON
In [2]:
a = [1 2 3; 4 5 6; 12 13 19]
Out[2]:
In [3]:
JSON.json(a)
Out[3]:
Simple datastructures result in simple JSON that the JSON module can handle on its own. For more complex datastructures, especially those involving DataFrames, you may have to write your own helper function.
Keep in mind that Julia's arrays are stored in column major order, which means iterating over a single column at a time is very fast compared to iterating a row at a time.
In [4]:
display("text/html", """
Adding script tag here:
<script type="text/javascript">
var a = $(JSON.json(a));
if (typeof window.console !== "undefined") {
console.log(a);
}
</script>
:done: <em>Inspect this DOM element and the elements around it</em>
""")
In [ ]: