Added function to insert structs as JS objects directly