added $returnFields parameters for toJson method