fix the bug of queryToJson function