You can easily see from the documentation (and in the samples page) that you can get all selected nodes by using getSelectedNodes
as:
$("#tree").dynatree("getSelectedNodes")
This will get you an array of all selected nodes, which you can pass to your JSON object without tampering with this, as JSON access arrays.
To use a preview, you can check the Drag'n'drop 3 sample.