Filtering JSON with PostgreSQL / Excluding elements of JSON array -
i want able return part of json using postgresql. example if have json
{ "dress_code": "casual", "design": "solid", "fit": "straight-cut", "aesthetic": [ { "aesthetic_id": 1, "primary_color": "light blue", "secondary_color": "light gray", "sizes": [ { "size_id": "1", "basic_size": "s", "waist": 30, "pictures": [ { "angle": "front", "url": "fashion.com/img1f" }, { "angle": "back", "url": "fashion.com/img1b" } ] }, { "size_id": "2", "basic_size": "m", "waist": 33, "pictures": [ { "angle": "front", "url": "fashion.com/img1f" }, { "angle": "back", "url": "fashion.com/img1b" } ] } ] }, { "aesthetic_id": 2, "primary_color": "dark blue", "secondary_color": "light gray", "sizes": [ { "size_id": "3", "basic_size": "s", "waist": 30, "pictures": [ { "angle": "front", "url": "fashion.com/img2f" }, { "angle": "back", "url": "fashion.com/img2b" } ] }, { "size_id": "4", "basic_size": "m", "waist": 33, "pictures": [ { "angle": "front", "url": "fashion.com/img2f" }, { "angle": "back", "url": "fashion.com/img2b" } ] } ] } ] }
and, example, want array , information of aesthetic_id = 2 , size_id = 4, be:
{ "dress_code": "casual", "design": "solid", "fit": "straight-cut", "aesthetic": [ { "aesthetic_id": 2, "primary_color": "dark blue", "secondary_color": "light gray", "sizes": [ { "size_id": "4", "basic_size": "m", "waist": 33, "pictures": [ { "angle": "front", "url": "fashion.com/img2f" }, { "angle": "back", "url": "fashion.com/img2b" } ] } ] } ] }
is there way filtering json data using postgresql?
Comments
Post a Comment