Added toFlatJSON method.

Maybe it's an edge case, but in my app this resolved a lot of things.
This method returns a flat representation of the model, where deep properties are returned as dotted paths.