split toJson function