Use serialize method to get widget positions. It returns a Array of objects that can be used as a JSON object.
serialize