toJson code Refactored
Added some unitTests for scalarProductItem and scalarProductResult. Not finished.