Added toJSON() method on Atom and Flux elements