Add toJson to query classes
Add toJson to query classes
Add json conversion to query classes