Implementation of conversion of Java object containing primitive types
and array into JSON