trying to manage a json query structure