Updated query for JSON