GraphQL how to filter on a field that is a JSON object
I have a content fragment template where there is a JSON type field that holds a list of image URLs. Each entry is a named field with the URL to an image as the value. This was done due to the maximum numbers of URLs that may be checked in validation of the text fields in a content fragment that look to be a URL.
What I'd like to do is reduce the size of the images JSON by selecting which field I want.
The normal returned response would be something like:
{
"data": {
"testModel": {
"items": [
{
"itemNumber": "369769",
"description": "Some description for the fragment",
"images": {
"image1": "/content/dam/images/image1.jpg",
"image2": "/content/dam/images/image2.jpg",
"image3": "/content/dam/images/image3.jpg",
"image4": "/content/dam/images/image4.jpg",
"image5": "/content/dam/images/image5.jpg",
"image6": "/content/dam/images/image6.jpg",
"image7": "/content/dam/images/image7.jpg",
"image8": "/content/dam/images/image8.jpg",
"image9": "/content/dam/images/image9.jpg",
"image10": "/content/dam/images/image10.jpg",
"image11": "/content/dam/images/image11.jpg",
"image12": "/content/dam/images/image12.jpg",
"image13": "/content/dam/images/image13.jpg",
"image14": "/content/dam/images/image14.jpg",
"image15": "/content/dam/images/image15.jpg",
"image16": "/content/dam/images/image16.jpg",
"image17": "/content/dam/images/image17.jpg",
"image18": "/content/dam/images/image18.jpg",
"image19": "/content/dam/images/image19.jpg",
}
}
]
}
}
}
What I would like is to have a way of getting the itemNumber, description, and images.image12 and not having to get the entire images object in the response.
Has anyone done this before or know of a way to do this?
Thanks in advance.