User bio
404 bio not found
Member since Nov 9, 2015
Pinned posts:
Replies:

Ended up writing my own based on https://github.com/intersystems/isc-json/blob/main/cls/_pkg/isc/json/path.cls which implements https://goessner.net/articles/JsonPath/ - syntax looks like this, where inputObject and result are both %DynamicAbstractObjects:

    Set result = ##class(%pkg.isc.json.transformer).For(inputObject
        ).Remove("$..url" // Remove URL
        ).Remove("$..requested_fields" // Remove requested_fields
        ).Remove("$..[?($IsObject(@) && (@.%Size() = 0))]" // Remove empty arrays/objects
        ).Remove("$..[?($IsObject(@) && (@.%Size() = 1) && (@.%GetTypeOf(1) = ""null""))]" // Remove one-element arrays containing only a null
        ).TransformElement("$..issue_type","$.name" // Replace issue type object with just the name
        ).TransformElement("$..priority","$.name" // Replace priority object with just the name
        ).TransformElement("$..status","$.name" // Replace status object with just the name
        ).TransformElement("$..[?($IsObject(@) && @.%IsA(""%DynamicObject"") && (@.""avatar_url"" '= """"))]","$.display_name" // Replace any user (indicated by avatar_url) with just the user's display name
        ).GetResult()

I'll probably get this into https://github.com/intersystems/isc-json at some point (subject to some process hurdles); if you're interested nag me here / via DM.

Open Exchange applications:
Certifications & Credly badges:
Global Masters badges:
Followers:
Following: