Sounds like dataset row/column subscripting. Just use dataset return type for the named query, and jsonify it in a transform. Going from dataset to json is "lossy", so should only be done at the point where Perspective needs it.
You might find this helpful: