This is almost certainly a misuse of the code behind the Content Delivery API in Umbraco, but I’ve discovered IApiContentResponseBuilder as a nice way to convert data from Umbraco into JSON.
Given a content node, I make a call to Build(iPublishedContentHere) and get the same JSON representation I would if I had made an API call.
What I am having trouble doing is passing faux arguments to control:
- Property Expansion (expand)
- Property Limiting (fields)
I may be crazy, but has anyone found themselves doing the same? I use this all the time to grab JSON representation of content or specific blocks and pass them to my web components on the frontend. I’ve also found it beneficial to use in my SignalR hubs.
If I could find a way to implement the expand and fields params, I’d be set.